AngularJS ui router mandatory parameters -
based on documentation, angularjs ui-router url parameters default optional. there way create mandatory parameters? when parameter missing or null not proceed page?
hope can me.
thanks
use ui routers resolve check if route params missing.
//example of single route .state('dashboard', { url: '/dashboard/:userid', templateurl: 'dashboard.html', controller: 'dashboardcontroller', resolve: function($stateparams, $location){ //check if url parameter missing. if ($stateparams.userid === undefined) { //do such navigating different page. $location.path('/somewhere/else'); } } })
Comments
Post a Comment