簡體   English   中英

將diese用作字符,而不像yml文件中的注釋

[英]use diese as a character, not like comment in a yml file

我嘗試在身份驗證后在我的security.yml中聲明使用angular的路由,可以重定向到#/ welcome,但可以將其視為注釋

default_target_path: #/welcome

我的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'
    });
}]);

只需為您的字符串添加雙引號,井號#字符即可轉義。

default_target_path: "#/welcome"

更新:不要在yml配置中定義默認的客戶端路由。 這應該是您的角度路由器配置的一部分。 當然,這取決於您使用的路由器。

這是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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM