Monday, September 15, 2014

Angular.js: controller as and routing

I talked about the new ‘controller as’ syntax before. It allows you to create an alias for your controller on your scope and use that inside your views:

If you don’t want to specify your controller inside your view and still want to use the ‘controller as’ syntax, this is also possible. On the $routeProvider an extra property is available which allows you to specify the alias there:

No comments: