angular.js - angularJs ngRoute怎么在路由传递空字符串及用ng-switch取得
phpcn_u1582
phpcn_u1582 2017-05-15 17:08:43
0
2
569
  .when('/asset/:type', {//资产详情路由
                templateUrl: 'tpl/asset.html',
                controller: 'assetCtrl'
            })

在路由config里面type的其中一个可能是为空值,不同的值跳转到的页面展示效果不一致,现在在页面用函数:
ng-click="jump('/asset/ ')"可以传递空字符串,但相应的跳转到页面后路由为:#/asset/%20,在后面自动加了%20, 然后在ng-switch="type" 里面使用ng-switch-when=" ",却显示不出相应的效果,也尝试过ng-switch-when="%20",都无法跳转到匹配的样式。请问应该怎么才能实现这个效果?

phpcn_u1582
phpcn_u1582

reply all(2)
phpcn_u1582

It is empty by default, no need to add a space character to achieve it

阿神

$locationProvider.hashPrefix('');

This is caused by the new version of ngroute adding an exclamation mark. Just get rid of him

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template