I have this code for wordpress:
1-Page : http://localhost/contact/
2- Post : http://localhost/hello-world/
var app = angular.module('localhost', ['ngRoute','ngSanitize','ngResource']);
app.config(function($routeProvider, $locationProvider,$controllerProvider) {
$locationProvider.html5Mode(true);
$controllerProvider.allowGlobals();
$routeProvider
.when('/:slug/', {
templateUrl: localiceTemplates.partials + 'page.html',
controller: getPages
})
.when('/:slug/', {
templateUrl: localiceTemplates.partials + 'post.html',
controller: getPost
});
As you see I'm using "when" for identic slug. But when I try to treat one has the category pages and the other post. I was trying to do something like the following
$routeProvider
.when('/:slug/', {
if(":category"=="pages"{
templateUrl: localiceTemplates.partials + 'page.html',
controller: getPages
})
}else{
templateUrl: localiceTemplates.partials + 'post.html',
controller: getPost
}