angular.js - Routing address passes optional parameters in angularjs1
世界只因有你
世界只因有你 2017-05-15 17:13:10
0
1
543

How to pass optional routing parameters in routing in angular1:

For example: www.test.com Pass optional route parameter id www.test.com/#/test/id in config:

$routeProvider.when('/test/:id',{
         templateUrl: 'test.html',
         controller: 'testCtrl'
})

If you write the id according to the above code, you must pass it. Once the id is empty, the corresponding page will not be displayed. Is there any way to pass this value as empty or optional

世界只因有你
世界只因有你

reply all(1)
洪涛

I kind of forgot about it, but I usually add it?

$routeProvider.when('/test/?:id',{
         templateUrl: 'test.html',
         controller: 'testCtrl'
})
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template