[英]use diese as a character, not like comment in a yml file
I try to declare a route to use angular,in my security.yml after authentication i well be redirect to #/welcome but consider it a comment 我尝试在身份验证后在我的security.yml中声明使用angular的路由,可以重定向到#/ welcome,但可以将其视为注释
default_target_path: #/welcome
my app.js 我的app.js
routeApp.config(['$routeProvider',function($routeProvider) {
// Routing system
$routeProvider
.when('/login', {
templateUrl: Routing.generate('login'),
controller: 'SecurityController'
})
.when('/welcome', {
templateUrl: Routing.generate('ard_backend_test'),
controller: 'WelcomeController'
})
.otherwise({
redirectTo: '/login'
});
}]);
Just add a double quote for your string and the hash # character will be able to escape. 只需为您的字符串添加双引号,井号#字符即可转义。
default_target_path: "#/welcome"
Update: Do not define the default client route in your yml configuration. 更新:不要在yml配置中定义默认的客户端路由。 This should be part of your angular router configuration.
这应该是您的角度路由器配置的一部分。 Depending which router you are using of course.
当然,这取决于您使用的路由器。
Here is an example with angular's default routeService : 这是angular的默认routeService的示例 :
angular.module('MyApp', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/welcome', {
templateUrl: 'partials/welcome.tpl.html',
controller: 'WelcomeCtrl'
}).
when('/some-other-route', {
templateUrl: 'partials/some-other-route.tpl.html',
controller: 'SomeOtherCtrl'
}).
otherwise({
redirectTo: '/welcome'
});
}]);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.