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

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -