I have a simple question that I haven't found an answer to yet.
In regular Angular JavaScript, if I have the beginning of a form like this:
<form novalidate action="" class="signupForm" name="signup.form">
<div class="row">
<div class="col-md-12 ">
<fieldset>
<input type="text" name="fullName" placeholder="Full Name" ng-model="signup.fullName" required />{{signup.fullName}}
<div ng-show="signup.form.$submitted || signup.form.$touched">
<span ng-show="signup.form.$error.required">Please enter your full name.</span>
</div>
</fieldset>
</div>
</div>
Using controllerAs for example, using SignupCtrl as signup with UI Router, I can reference my form in my controller like this:
.controller(function() {
this.form // shows me my form
});
However, in TypeScript, this refers to my class and its own variables and methods, unless I am mistaken. How can I reference the form, or anything, in my TypeScript controller? How is scope bound to the view now?
export class SignupCtrl implements ISignupCredentials {
constructor(protected $http: ng.IHttpService,
protected $q: ng.IQService,
protected $scope: IScope) {
console.log(this.form); // undefined because form doesn't exist in my controller class
}
}