It would be good to add .otherwise instruction to redirect to default
location.
+ I'd recommend to define home path as "/".
$routeProvider
.when('/home',{
templateUrl:'partials/basic-template.html',
controller:'Basicontroller'
})
.otherwise('/home');
воскресенье, 31 мая 2015 г., 15:54:08 UTC+3 пользователь leesider написал:
>
> I am having a problem with an AngularJS app/site. I have an index.hmtl
> file made up of the following:
> <!DOCTYPE html>
> <html ng-app="myModule" ng-controller="Basicontroller">
> <head>
> <script src="js/angular.js"></script>
> <script src="js/angular-route.js"></script>
> <script type="text/javascript" src="modules/myModule.js" >
>
> </script>
>
> <title>
> </title>
> </head>
> <body>
>
> <div ng-view>
> </div>
>
> </body>
> </html>.
>
> My module.js file is the following:
>
>
> var ciqApp = angular.module('myModule',['ngRoute']);
>
>
>
>
> ciqApp.config(['$routeProvider',
> function($routeProvider){
>
> $routeProvider.
> when('/home',{
> templateUrl:'partials/basic-template.html',
> controller:'Basicontroller'
> });
>
> }]);
>
> function MainController($scope){
>
>
> }
>
> function Basicontroller($scope){
> $scope.title = 'this is the title';
> $scope.body = 'Welcome...';
>
> }
> My partial html file is:
>
>
> <h1>{{title}}</h1>
> <h4>{{body}} </h4>
>
>
>
> My partial file is not loading when I load "Index.html". My angular files
> (angular.js
> and angular-route.js) are up-to-date.I have no errors in javascript
> console.
> Any help is appreciated.
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.