我正在尝试设置以下这些路线,但是当我测试它们无法正常工作时,有人可以帮我解决这个问题。当我点击下面的任何链接时,它们不起作用
'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 :(得分:-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",
})
home.html的
<a href="#/dashboard">