2016-11-07 7 views
0

私はWebアプリケーションを開発するために、角度のついたテンプレートを使用しています。下記のルート設定コードファイル。Angular SPAメニューへの外部リンクを追加するには?

(function(){ 
'use strict'; 

var app = angular.module('app'); 

// Collect the routes 
app.constant('routes', getRoutes()); 

// Configure the routes and route resolvers 
app.config(['$routeProvider', 'routes', routeConfigurator]); 

function routeConfigurator($routeProvider, routes) 
{ 
    routes.forEach(function(r) 
    { 
     setRoute(r.url, r.config); 
    }); 

    $routeProvider.otherwise({ redirectTo: '/' }); 

    function setRoute(url, definition) 
    { 
     definition.resolve = angular.extend(definition.resolve || {}, { 
      prime: prime 
     }); 

     $routeProvider.when(url, definition); 
    } 
} 

prime.$inject = ['datacontext']; 
function prime(dc) { return dc.prime(); } 

// Define the routes 
function getRoutes() 
{ 
    return [ 
     { 
      url: '/', 
      config: { 
       templateUrl: 'app/dashboard/dashboard.html', 
       title: 'dashboard', 
       settings: { 
        nav: 1, 
        content: '<i class="fa fa-dashboard"></i> Dashboard' 
       } 
      } 
     }, { 
      url: '/customers', 
      config: { 
       title: 'customers', 
       templateUrl: 'app/customer/customers.html', 
       settings: { 
        nav: 2, 
        content: '<i class="fa fa-calendar"></i> customers' 
       } 
      } 
     }, 
     { 
      url: '/customer/:id', 
      config: { 
       title: 'customer', 
       templateUrl: 'app/customer/customerdetail.html', 
       settings: {} 
      } 
     } 
    ]; 
}})(); 

メニューに外部リンクを追加する必要があります(例:www.google.com)。私はこのルート設定に別のリンクを追加するにはどうすればいいですか?

{ 
     url: 'www.google.com', 
     config: { 
      title: 'MyExternalLink', 
      settings: {} 
     } 
    } 
+0

''

+0

がありますか? –

+0

Nikhilは機能していません – Wella

答えて

関連する問題