【发布时间】:2015-06-11 03:14:22
【问题描述】:
我正在构建一个新的 Rails API / Angular 应用程序。我有两个基本页面,一个是 Gulp 生成的默认页面。我对这些重定向有点迷茫。
如果我输入这个:
浏览器将主页重定向到这个地址(注意哈希):
当我输入时:
http://localhost:9000/sentences
然后浏览器也会重定向主页,并在浏览器中使用此地址:
http://localhost:9000/sentences#/main
'use strict';
angular.module('myapp', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSanitize', 'ngRoute', 'ui.bootstrap'])
.config(function ($routeProvider) {
$routeProvider
.when('/main', {
templateUrl: 'app/main/main.html',
controller: 'MainCtrl'
})
.when('/sentences', {
templateUrl: 'app/sentences/sentences.html',
controller: 'SentencesCtrl'
})
.otherwise({
redirectTo: '/main'
});
})
;
【问题讨论】:
标签: ruby-on-rails angularjs gulp route-provider