0

Using alias for controller with ng-controller

We could use ng-controller to give an controller an alias within the same html page, i.e., view . Normally, I would set this up as part of a state’s config and have it invoked via the angular.run function.

The Recommended way

– OR –

The Alternative way

An alternative way uses only ng-controller with the “AS <ALIAS-NAME>” convention.

Download the Files

You may download a working example via the following URL.

https://www.dropbox.com/s/afzkcmqfbgx5oz2/ng-controller-as.zip?dl=0

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert