I've got a controller in Angular JS.
In this controller i've got a $scope.users property : it's an array of users.
This controller is used by two views: /users and /users/:id.
I've seen that the $scope.users models is init each time i come to an user view.
My question is simple how to do to get the $scope.users applied only to the /users view and not to the /users/:id view ?
I've done this with the $location.path method, but i don't know if it's the right way.
PS : I've got a factory to retrieve the users so i know it's a singleton ...
Thx for your answers.
I've got the answer !
In fact AngularJS it's not a MVC framework but an MVVM framework. In this case the controller is the Model (in MVVM pattern), the $scope the ViewModel and the HTML the View (the ng-controller is the dataContext in pure .NET MVVM).
In this case a controller should have only a view !!
"In general, a controller shouldn't try to do too much. It should contain only the business logic needed for a single view."
http://docs.angularjs.org/guide/dev_guide.mvc.understanding_controller
Thx to you guys. Hope it helps.