I'm trying to add the class post
to my div #wrap
when i'm on the page /post
. That's what I have:
$routeProvider
when('/post', {
templateUrl : 'views/post.php',
controller : 'postCtrl'
})
Controller
carolvaladares.controller('postCtrl', function($scope) {
$scope.post = true;
});
HTML
<div id="wrap" ng-class="{true: 'post'}[post]">
When on /post
, $scope.post
is true
. If the $scope.post
is true
, add the class post
to #wrap
The thing is that when I go to /post
, It does not read the $scope.post
unless I use ng-controller="postCtrl"
manually.
Thanks in advance.
-- EDITED --
The $scope.post
returns true
when I use {{post}}
on /post
. Still I can't work with ng-class
.
-- EDITED --
The problem still happening because the #wrap
is out of my ng-view
. So I guess what I'm trying to do, the way I'm trying to do won't be possible.