Angularjs 带轨道的角度-角度模板无法正确加载
我正在学习如何使用angularjs路由和模板,我遇到了一个问题。我在Gemfile中添加了gem,在application.js中添加了//=require angular rails模板,并在我的主angular.module中添加了依赖性。看起来一切正常,但模板渲染不正确Angularjs 带轨道的角度-角度模板无法正确加载,angularjs,ruby-on-rails-4,angularjs-routing,Angularjs,Ruby On Rails 4,Angularjs Routing,我正在学习如何使用angularjs路由和模板,我遇到了一个问题。我在Gemfile中添加了gem,在application.js中添加了//=require angular rails模板,并在我的主angular.module中添加了依赖性。看起来一切正常,但模板渲染不正确 angular.module('authentication', ['authenticationModule','ngRoute','templates']) .config(['$routeProvider'
angular.module('authentication', ['authenticationModule','ngRoute','templates'])
.config(['$routeProvider',function($provider){
$provider
.when('/sign_in', { templateUrl: 'assets/signin.html', controller: 'redirectCtrl'})
.when('/sign_up', { templateUrl: 'assets/signup.html', controller: 'redirectCtrl1'})
}])
.controller('redirectCtrl', function($location) {
// $location.path('/sign_in')
})
.controller('redirectCtrl1', function($location) {
// $location.path('/sign_up')
})
这是我得到的,模板加载了,但是有一些额外的东西,我不需要
这是我的注册页面中的代码,应该呈现
<div ng-controller="authenticationCtrl">
<h1>Register</h1>
<div>
<div>
<div>Email: <input ng-model="email1" type="email"/></div>
<div>Password: <input type="password" ng-model="password1" /></div>
<div>Password Confirmation: <input type="password" ng-model="password2" /></div>
<button ng-click="register()" >Register</button>
</div>
</div>
</div>
从模板URL中删除资源。因此,它应该是:
templateUrl: 'signin.html'
而不是
templateUrl: 'assets/signin.html'
angular rails模板缓存路径中没有资源的模板。存在完全相同的问题。如果我发现任何东西,将更新。
templateUrl: 'assets/signin.html'