Search code examples
angularjsangular-controllerangularjs-1.6

Unable to render the variables inside controller function to view


Here is my code on plunkr

I am unable to get the view on orders.html from the controller OrdersController inside controllerOrder.js file. For some reason I am not able to render the variables of OrdersController controller onto the view.


Solution

  • EDIT:

    Try this link.

    In controllerCustomer.js file, it was controllersAs: 'OrdersCtrl' instead of controllerAs: 'OrdersCtrl'. And answer to your question is yes, it is redundant to specify the controller in the template as well.

    Generally, UI Router is regarded as a better solution for AngularJS routing. You can checkout this link for more details.