简体   繁体   中英

ng-include and ng-route are not working in chrome

The below ng-include and ng-route are working fine in FireFox. But, when i see in google chrome it is not showing any thing. it is just showing blank white page.

please suggest me solution.

Thanks in advance.

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular-route.min.js"></script>

<body ng-app="sampleApp">

    <div ng-include="'top-navi.html'"></div>

    <div ng-view></div>


</body>

<script>

var module = angular.module('sampleApp', ['ngRoute']);

module.config(['$routeProvider', 
function($routeProvider){
$routeProvider
.when('/route1/:param',{
templateUrl: 'route1.html',
controller: 'RouteController'
})
.when('/route2/:param',{
templateUrl: 'route2.html',
controller: 'RouteController'
})
.otherwise({
rediretTo: '/'
});
} 
]);
module.controller("RouteController", function($scope, $routeParams){
$scope.param = $routeParams.param;
})
</script>

You need to install web server to your local environment.

IE: Install npm package called lite-server to run your code.

npm lite-server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM