diff options
| author | Misko Hevery | 2012-06-06 15:54:40 -0700 |
|---|---|---|
| committer | Misko Hevery | 2013-04-22 23:28:41 -0700 |
| commit | cd38cbf975b501d846e6149d1d993972a1af0053 (patch) | |
| tree | 3857a2879f782c6b7f1350fcd5c8d52e082fd160 /src/ng/route.js | |
| parent | 021bdf3922b6525bd117e59fb4945b30a5a55341 (diff) | |
| download | angular.js-cd38cbf975b501d846e6149d1d993972a1af0053.tar.bz2 | |
feat(controller): support as instance syntax
Support ng-controller="MyController as my" syntax
which publishes the controller instance to the
current scope.
Also supports exporting a controller defined with route:
````javascript
angular.module('routes', [], function($routeProvider) {
$routeProvider.when('/home', {controller: 'Ctrl as home', templateUrl: '...'});
});
````
Diffstat (limited to 'src/ng/route.js')
| -rw-r--r-- | src/ng/route.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ng/route.js b/src/ng/route.js index b52f4351..7651a806 100644 --- a/src/ng/route.js +++ b/src/ng/route.js @@ -44,6 +44,8 @@ function $RouteProvider(){ * - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly * created scope or the name of a {@link angular.Module#controller registered controller} * if passed as a string. + * - `controllerAlias` – `{sttring=}` – A controller alias name. If present the controller will be + * published to scope under the `controllerAlias` name. * - `template` – `{string=|function()=}` – html template as a string or function that returns * an html template as a string which should be used by {@link ng.directive:ngView ngView} or * {@link ng.directive:ngInclude ngInclude} directives. |
