While wring angular application, I found that there are 2 choices to wire up controller’s attributes with html template.
So, I am wondering which one is the best programming practise.
Official documents shows usage for both of them. For example, here shows you how to do the linking by using
this
and controller as
syntax while here shows you how to do that by using $scope
angular service.
However, after digesting the most common answers from stackoverflow, I decided to use the
this
way to write my angular application.
Well, syntax in the first approach is more native and without the necessity to inject $scope to my controller is another good thing to point out.
沒有留言:
張貼留言