ルーティングが機能しない理由がわかりません。View1.html は単純な Web ページで構成されており、view2.html も同様です。view1.html と view2.html はどちらも partials というフォルダーにあり、「angular-route.js」と「angular-route.min.js」はホームフォルダーの node_modules というフォルダーにあります。ubuntu14.04を使用しています。
<script src="scripts/angular.min.js"></script>
<script src="/node_modules/angular-route/angular-route.js"></script>
<script src="/node_modules/angular-route/angular-route.min.js"></script>
<script>
var demoApp = angular.module('demoApp', ['ngRoute']);
demoApp.config( function ($routeProvider) {
$routeProvider
.when('/',
{
controller: 'SimpleController' ,
templateUrl: 'partials/view1.html' //
})
.when('/view2',
{
controller: 'SimpleController' ,
templateUrl: 'partials/view2.html'
})
.otherwise({ redirectTo : '/' })
})
demoApp.controller('SimpleController', function ($scope)
{
$scope.customers = [{name:'nihal',city:'hyderabad'},{name:'nihal',city:'mumbai'}, {name:'john',city:'bangalore'}]
$scope.addCustomer = function() {
$scope.customers.push({name: newCustomer.name , city: newCustomer.city })
}
})
</script>
</body>
</html>