1
我不能让这段代码的工作,不明白为什么它没有显示该按钮:(不能让角1.5(以打字稿)组件工作
任何想法?谢谢。
https://jsfiddle.net/slishnevsky/Let38jho/10/
角/打字稿
let app = angular.module('app', []);
export class MyController {
public name: string;
constructor() {}
}
export class MyComponent implements ng.IComponentOptions {
public bindings: any;
public controller: any;
public controllerAs: string;
public template: string;
constructor() {
this.bindings = {
name: '@'
};
this.controller = MyController;
this.controllerAs = 'vm';
this.template = '<button>{{vm.name}}</button>';
}
}
app.component('MyComponent', new MyComponent());
HTML
<div ng-app='app'>
<my-component name='Miranda'></my-component>
</div>