28 lines
804 B
TypeScript
28 lines
804 B
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { RoleListDataSource } from './role-list-datasource';
|
|
import { Role } from '../role';
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
@Component({
|
|
selector: 'app-role-list',
|
|
templateUrl: './role-list.component.html',
|
|
styleUrls: ['./role-list.component.css']
|
|
})
|
|
export class RoleListComponent implements OnInit {
|
|
dataSource: RoleListDataSource;
|
|
list: Role[];
|
|
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
|
displayedColumns = ['name', 'permissions'];
|
|
|
|
constructor(private route: ActivatedRoute) {
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.route.data
|
|
.subscribe((data: { list: Role[] }) => {
|
|
this.list = data.list;
|
|
});
|
|
this.dataSource = new RoleListDataSource(this.list);
|
|
}
|
|
}
|