angularjs - Separate models from controllers -


i have -

function detailctrl($scope) {     $scope.persons = [{         id: 1,         name: "mark"     }];         } 

i'd keep models separate controller, -

    //models     var person = { id: '', name: '' };      function detailctrl($scope) {        person = db.getperson();        $scope.person = person;     } 

is practice in angularjs? come asp.net mvc background.

yes, best practice have models elsewhere, , have scopes reference models: listen 2 minutes of misko "best practices" video.

services place store models.
brandon has answer related this: https://stackoverflow.com/a/14667066/215945


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -