0
我学习angularjs与轨,但我卡住了,当我要求如何处理angularjs路线与轨道
http://localhost:3000/#/users
它呈现的默认轨welocome页
下面是我的app.js文件
var app = angular.module('myApp', ['ngRoute', 'ngResource']);
app.controller('myCtrl', function($scope) {
$scope.firstName = "John";
$scope.lastName = "Doe";
});
app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$routeProvider.when('/users',{
templateUrl: 'home.html',
controller: 'myCtrl'
}
);
}]);
application.html.erb
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<title>Books</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>
<div class="container" ng-view>
<%= yield %>
</div>
</body>
</html>