我有以下代码,我希望variable
在页面中显示属性的内容。我阅读了几篇文章并试图找出我做错了什么,但找不到错误。这是代码:
namespace testWeb.about {
class AboutComponent implements ng.IComponentOptions {
templateUrl = "scripts/components/about/about.html";
controller = AboutController;
bindings: any;
constructor() {
this.bindings = {
awesomeThings : '<',
property : '<'
};
}
}
interface IAboutController {
awesomeThings: Array<string>;
property: string;
}
export class AboutController implements IAboutController, ng.IComponentController {
awesomeThings: Array<string>;
property: string;
constructor() {
this.awesomeThings = [
"one",
"two",
"three"
];
this.property = "123";
}
}
angular.module("test_web")
.component("about", new AboutComponent())
.config(($stateProvider) => {
"ngInject";
$stateProvider
.state("about", {
url: "/about",
template: `<about></about>`
});
});
}
是否<span ng-repeat="dd in $ctrl.awesomeThings">{{dd}}</span>
也不会<span class="as">{{$ctrl.property}}</span>
显示。
<span ng-repeat="dd in $ctrl.awesomeThings">{{dd}}</span>
<span class="as">{{$ctrl.property}}</span>
<p>123</p>