Every time I launch the application, the angular {{ }} tags remain visible. Removing $scope.$apply eliminates the braces and displays the correct value.
I am utilizing Angular with Typescript.
Controller:
module Application.Controllers {
export class TestController {
public hello: string = "hello";
private scope: any;
constructor($scope: ng.IScope) {
this.scope = $scope;
this.scope.hello = "Hi";
this.scope.$apply();
alert('no errors');
}
}
}
Controller Definition (in an initialization function a few seconds after the app loads):
var appController2 = AppModule.controller("TestCTRL", ["$scope", Application.Controllers.TestController]);
The view:
<div ng-controller="TestCTRL as t">
<div>{{ t.hello }} {{ 1 - 1 }}</div>
</div>
Instead of seeing "Hello 0" I see {{ t.hello }} {{ 1 - 1 }}
If I remove the this.scope.$apply call, it works, but it shows hello instead of hi.
I am using IE 11, Angular 1.4.9
I also have 2 other functioning controllers in my DOM, and whenever it reaches this one, it halts unless I eliminate $scope.$apply