Angularjs angular 1.3中的Typescript和ng不起作用
我将controllerAs语法与ng include一起使用,这是布局Angularjs angular 1.3中的Typescript和ng不起作用,angularjs,typescript,Angularjs,Typescript,我将controllerAs语法与ng include一起使用,这是布局 <div ng-controller="MainCtrl as vm" ng-include src="'partial.html'"></div> 谢谢 从文档中可以看出,当您使用ng include作为属性时,您没有使用src。请尝试ng include=“'partial.html'”另外,按钮在哪里?在这里似乎工作正常~您必须在html上编写ng click=“vm.setTitle()”
<div ng-controller="MainCtrl as vm" ng-include src="'partial.html'"></div>
谢谢 从文档中可以看出,当您使用
ng include
作为属性时,您没有使用src
。请尝试ng include=“'partial.html'”
另外,按钮在哪里?在这里似乎工作正常~您必须在html上编写ng click=“vm.setTitle()”
,才能工作
<div class="col-sm-12">
<div class="panel panel-primary">
<div class="panel-heading">{{vm.title}}</div>
</div>
</div>
class MainController implements IMainController {
public title :string;
constructor() {
this.title = "Test";// this works.
}
}
public setTitle(): void {
this.title = "New Test"; this does not work !
}