Vsnrycumtechy Vsnrycumtechy - 6 days ago 7
AngularJS Question

what does the '.' in state name in Angularjs state provider mean?

what is the significance of '.' in state('xxx.yyy') in Angularjs 1.x?

Q1) Are the 2 states emAllTickets.closed and emAllTickets/closed are different? what is the significance of . and / here?

Q2) if i have a html code which routes to /closed, will it call both? emAllTickets and emAllTickets.closed?

sample code:

.state('emAllTickets',
angularAMD.route({
url: '/emAllTickets?locaID&type&gId',
templateUrl: 'app/partials/emAllTickets/emAllTickets.html',
controllerUrl: 'app/controllers/emAllTickets/emTicketsTableCtrl.js',
resolve:{
checkTrinityAccess: function($q,commonService){
var deferred = $q.defer();
commonService.verifyTrinityRestriction(deferred);
return deferred.promise;
}
}
})
)

.state('emAllTickets.closed',
angularAMD.route({
url: '/closed',
templateUrl: 'app/partials/emAllTickets/closed.html'
})
)


.state('emAllTickets/closed',
angularAMD.route({
url: '/emAllTickets/closed',
templateUrl: 'app/partials/emAllTickets/emAllTickets.html',
controllerUrl: 'app/controllers/emAllTickets/emTicketsTableCtrl.js'
})
)

Answer

Q1) Yes, they are different. According to the docs the '.' notation creates a parent/child state.

Q2) Yes, the whole parent to child path gets active.

Comments