I am struggling with my Angular 1.5 app that uses Typescript. Here is a snippet of my code:
mymodule.module.ts:
angular.module('mymodule', []).component('mycomponent', new MyComponent());
mycomponent.component.ts
export class MyController {
public authorized: boolean;
constructor() {
this.authorized = false;
}
}
export class MyComponent implements ng.IComponentOptions {
controller = MyController;
controllerAs = 'vm';
templateUrl = $partial => $partial.getPath('mytemplate.html');
}
mytemplate.html
...
<div ng-show="vm.authorized">
...
</div>
...
I am facing an issue where vm and vm.authorized are not recognized in mytemplate.html file, causing the div to always show. Can anyone point out what I might be doing wrong?