angularjs - Angular $http appears to make two server calls -


i'm using angulars $http make calls backend services. can't figure out why ui appears make 2 calls services. navigate angular partial using ui-router so

$stateprovider.state('new/client', {         url: '/client/new',         templateurl: globalcontextpath + '/javascripts/partials/modals/client/new.html',         controller: 'newclientmodalcontroller'     }) 

once in partial , controller initialize bit of data.

var vm = this;  var retrieveservers = function () {     appserverfactory.list()         .then(function (success) {             $log.debug(success);             vm.appserverlist = success.data;             (var = 0; < vm.appserverlist.length; i++) {                 if (vm.appserverlist[i].defaultitem == true) {                     vm.clientservers.push(vm.appserverlist[i]);                 }             }         }); };  retrieveservers(); 

the factory function itself

factory.list = function () {     return $http.get(globalcontextpath + '/api/app-server/list'); }; 

versioning:

"dependencies": {     "angular": "angularjs#~1.4.6",     "angular-ui-router": "~0.2.15",     "bootstrap": "~3.3.5",     "jquery": "~2.1.4" } 

i've tried taking route of just using $http controller seems no matter use $http throughout app calls doubled backend - observed looking @ hibernate queries running twice when front end hits backend services. believe have ruled out backend using soap client , not observing same behavior. suspicion point have - if place breakpoint in functions appears controller loaded twice. i'm investigating if i'm using ui-router incorrectly no luck yet. curious if has hints while continue stumble.

i had problem when first began using ui-router, defining controller both in routes , explicitly in html. there chance defined in html well?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -