I am getting attached to get this simple routing to work and can't figure out what the problem is.
This is HTML:
<html lang="en" ng-app="app">
.
.
.
<a href="#voip">
<div class="col-lg-3 service">
<img src="assets/img/voip.svg"/>
<h4 ng-bind-html="content.home.voip_header"></h4>
<p ng-bind-html="content.home.voip_txt"></p>
</div>
</a>
<section id="view">
<div ng-view></div>
</section>
Run codeHide resultThis is the routing:
var app = angular.module('app',[
'ngRoute',
'ngSanitize'
]);
app.config(['$routeProvider',function($routeProvider){
$routeProvider
.when('/voip',{
templateUrl:'assets/templates/voip.html'
});
}]);
The template loads if I specify "otherwise", as shown below. I thought maybe I was using the wrong syntax in my href attribute, but I looked everywhere and it seemed to be the way it should be.
.otherwise({
redirectTo:'/voip'
})
Another thing, if I listen $routeChangeSuccess, the event fires, but the view does not load.
Any ideas?
source
share