I understand one way of doing it is attaching the controller object to the scope like below.
interface IAppCtrlScope extends ng.IScope {
info: any;
}
class InfoCtrl {
header: string;
name: string;
public static $inject = ["$scope"];
constructor(private $scope: IAppCtrlScope) {
this.$scope.info= this; //expose controller
}
getData(): void {
//do something
}
}
In this case the view will be something like this,
<div ng-controller="InfoCtrl">
<div class="rm-dialog-header">{{info.header}}</div>
<span ng-click="info.getData()">{{info.name}}</span>
</div>
Instead of the above is there a way to expose the controllers so that I dont have to prefix each scope variable with 'info.'. So that the view will be like this,
<div ng-controller="InfoCtrl">
<div class="rm-dialog-header">{{header}}</div>
<span ng-click="getData()">{{name}}</span>
</div>
Is it possible or am I missing something?