【发布时间】:2014-10-26 04:50:06
【问题描述】:
我正在尝试使用 angular 和 angularfire 设置路由,但遇到了麻烦。
var app = angular.module('sampleApp', ['ngRoute', 'firebase', 'ui.bootstrap']);
app.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'index.html',
controller: 'SampleCtrl'
})
.when('/login', {
templateUrl: 'views/login.html',
controller: 'LoginCtrl'
})
.otherwise({
redirectTo: '/'
});
});
app.controller('LoginCtrl', function($scope, $firebase){
console.log('LoginCtrl')
})
当我尝试点击 localhost:8000/login 时,我收到以下错误消息
Error code explanation: 404 = Nothing matches the given URI.
如何使用 ngRoute 和 AngularFire 设置简单的路由?
【问题讨论】:
标签: javascript html angularjs firebase angularfire