結合:Angular2:入力、ここで定義されるように、私はコンポーネントで入力をバインドしようとしています
https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#parent-to-child しかしコンポーネント名が
私もにconsole.logをやろうとしていますが示されることはありませんが、それは示しています
をisundefinedコンポーネント名が
とerror.htmlで
<div> you are not allowed to access {{component}} </div>
デモエラー:
import { Component, OnInit,Input } from '@angular/core';
@Component({
selector: 'demo-error',
templateUrl: './error.component.html',
styleUrls: ['./error.component.css']
})
export class ErrorComponentDemo implements OnInit {
@Input() public componentName:string;
constructor() {
console.log("componentName is" +this.componentName)
}
ngOnInit() {
}
}
And in **CustomerComponent:**
@Component({
selector: 'customer',
templateUrl: './customer.component.html',
styleUrls: ['./customer.component.css']
})
export class CustomerComponent extends SuperChildComponent{
public allowed: boolean = false;
public accessLevel:AccessLevel =null;
public componentname:string;
constructor(private authenticationService : AuthorizationService) {
super();
this.componentname=this.constructor.name;
this.accessLevel=this.authenticationService.isUserLoggedIn()?this.authenticationService.componentAccessLevel(this.constructor.name):null;
}
私はここで何をしないのですか?
ありがとうございました