I have menu controller on the main ('/')
.
I have journal button which is located at ('/users')
.
The journal button activates the directive template (isolated scope) with data. My goal is to add this button to the main menu. I've done by emitting from directive with rootScope.
Inserted <my-directive></my-directive>
inside the main page. Inner part of the template consists of journal body components.
I've written extra style for those journal components and case when I call method to open journal on the main page.
The problem: I'm using ng-class with condition below
<div class="" ng-if="isOpenTab" ng-class="currentPage === 'slp-editor' ? 'editor-journal-tab': 'users-journal-tab'">
Output: one part of condition works only at all pages. Since when I'm on the main page, there is prop currentPage
inside its scope, so by default users-journal-tab
class applies.
How to get different classes on the same template on the different pages?
UPD: Successfully resolved this problem. The problem was in binding data of journal's directive with main menu's controller. As far as currentPage
is a prop of main menu's scope. It receives String value only, i.e. 'slp-editor'
. So I've used string binding option @
on currentPage
prop inside of journal's directive.