2016-08-05 4 views
0

아래의 경로를 설정하려고합니다.하지만 작동하지 않을 때 누군가 나를 도와주세요. 나는 아래 링크 중 하나를 클릭하면, 그들은이 이동 홈 이름 로그인 페이지입니다Angular ng route

'use strict' 
var myApp = angular.module("myApp", ["ngRoute", 'firebase']); 

    myApp.constant('FIREBASE_URL', 'myfirebase Url'); 

myApp.config(['$routeProvider','$locationProvider', function($routeProvider, $locationProvider){ 

$routeProvider 
    .when('/', 
     {templateUrl:'partials/home.html', 
      controller: 'mainController' 
     }) 
    .when('/login', { 
     templateUrl:'partials/login.html', 
     controller: 'loginSignupController' 

     }) 
    .when('/signup', { 
      templateUrl:'partials/signup.html', 
      controller:'loginSignupController' 
     }) 
    .when('/dash', { 
      templateUrl:'partials/dashboard.html', 
      controller:'mainController' 
     }). 

    otherwise({ 
     redirectTo:'/' 
    }); 

    $locationProvider.html5Mode(true); 
}]); 

Signup.html

<h1>Welcome to Signup</h1> 

<a class="" ng-href="/">Go Home</a> 
<form class="ui form"> 
<div class="field"> 
<label>Username </label> 
<input type="text" name="username" placeholder="Username"> 
</div> 
<div class="field"> 
    <label>Password</label> 
    <input type="password" name="username" placeholder="password"> 
</div> 


<button class="ui button" type="submit" ng-submit="">Signup</button> 
</form> 

login.html 작동하지 않습니다 비밀번호

</div> 
<button class="ui button" type="submit">Login</button> 
</form> 

home.html을

<div class="ui container"> 
    <div class="ui large secondary inverted pointing menu"> 
    <a class="toc item"> 
     <i class="sidebar icon"></i> 
    </a> 
    <a class="active item">Home</a> 
    <a class="item">About Us</a> 
    <a class="item">Send</a> 
    <a class="item">Request</a> 
    <a class="item">How it Works</a> 
    <div class="right item"> 
     <a class="ui inverted button" ng-href="partials/login">Log in</a> 
     <a class="ui inverted button" ng-href="partials/signup">Sign Up</a> 
    </div> 
    </div> 
</div> 
+0

당신이 HTML로 각도 및 각 경로에 대해 참조했다 home.html을? – Sajeetharan

+0

'index.html'에'ng-view'가 있습니까? –

+0

왜'ng-href = "partials/login"'로 리디렉션하려고합니까? 경로 경로는 **/login **이므로 'ng-href = "/ login"'(다른 링크들에 대해서도 동일하게 변경하십시오.) –

답변

-2
var App = angular.module("MyApp", ["ui.router"]); 
MetronicApp.config(['$stateProvider', '$urlRouterProvider',function($stateProvider, $urlRouterProvider) { 
// Redirect any unmatched url 
$urlRouterProvider.otherwise("/dashboard"); 

$stateProvider 

    // Dashboard 
    .state('dashboard', { 
     url: "/dashboard", 
     templateUrl: "views/dashboard.html",    
     data: {pageTitle: 'Dashboard'}, 
     controller: "DashboardController", 

    }) 

<a href="#/dashboard"> 
+0

타사 라우팅 라이브러리를 솔루션으로 사용하는 이유는 무엇입니까? 그것은 대안이지만, 나는 그것이 질문에 대답한다고 생각하지 않는다. –

+0

나는 고마워 할 것이다. – amad4biz