samedi 19 novembre 2016

Controllers in AngularJS and templates

I'm fairly new to AngularJS and I want to have the best practices from start. I want to know where should I put which controller I'll be using for a specific template. For now I've used this two : 1 : in the html of the template

<div ng-controller="ImageManagerController"> </div>

2 : in my routes.js

  .state('home',{
     url : '/',
     templateUrl : '/src/images/views/home.html',
     controller : 'ImageManagerController'
})

Is one of them better than the other?

Thanks for your time!

Aucun commentaire:

Enregistrer un commentaire