Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Controller doesn't call function on loading

$
0
0

@Ionicoser wrote:

Hi all,

maybe someone know why my function dosn't fire at first time. It fires only if i change my route to another page and back to the first page.

My Route-Settings:

$stateProvider
//APP
.state('app', {
url: '/app',
cache: false,
abstract: true,
templateUrl: 'templates/app.html',
controller: 'appCtrl',
})
.state('app.home', {
url: '/home/:id',
cache: false,
views: {
'appContent': {
templateUrl: 'templates/app/home.html',
controller: 'appHomeCtrl',
},
},
})

My appHomeCtrl (the "test"-Altert works fine at the initial loading. The myCall works only if i call the route again.

alert('test');

var myCall = myService.myCall().then(
 function (success) {
  alert(success);
 },
 function (error) {
  alert(error);
 }
);

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles