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>