我的JS在制作方面失败了。我尝试过几种不同的方法,但没有成功。我的JS是:
angular
.module('MyApp', [
'ngRoute',
'templates',
'ui.bootstrap.tpls',
'ui.bootstrap',
])
.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'home.html',
controller: 'LoginCtrl'
})
$locationProvider.html5Mode(true);
}])
我的控制器使用以下语法实例化
angular.module('MyApp')
.controller('LoginCtrl', ['$scope', '$http', function($scope, $http) {
$scope.user;
}])
Applicaiton.js
//= require angular
//= require angular-route
//= require angular-rails-templates
//= require thirdparty/jquery-2.1.1.min.js
//= require myapp/app.js
//= require myapp/controllers/myapp.js
//= require thirdparty/ui-bootstrap-tpls.0.11.0.js
//= require_tree ../templates
最后是我的application.html
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
但是我一直收到以下错误[$injector:nomod] Module 'MyApp' is not available!
。我知道这很简单,但这让我发疯。任何帮助是极大的赞赏。