Sure, you can use ng-if on an element to show or hide it.
But from your code it’s not apparent what you’re doing with ‘project’ in the ng-if statement. It will always set as true so the tab will always display.
<ion-view title="Nubb Offline">
<ion-content class="has-header padding">
<h1>Welcome home</h1>
<p ng-if="project">Project has been set to {{project}}</p>
</ion-content>
</ion-view>
Now if I change $scope.project = false; then the message does not display inside app-home view not inside the app.html view. Must be something I am missing with perhaps scope’s shared across multiple views or inside the abstract view.
You’re not calling StandController anywhere, not in your router setup or your partial.
You’re just setting $scope.project to true in your HomeController, which will lead the tab to display. If you set it to false, the tab won’t display.
I’m not clear on your question now: originally you wanted the tab to display conditionally based on something. Now you want some message to appear where?
Could you also set up a Plunker / Codepen with your code? That will lead to easier debugging / support.
@coen_warmer as it is in the example, I just wanted the display/not-display to work. ie to display the navtab or not display the navtab based on the setting in the HomeController. But even if I set it to true it does not display the tab at all. It is like app.html does not see $scope.project.
I will look at getting something up on Codepen or Plunker.
In the codepen sample I am just trying to get a simple case working, if a condition is met display the additional tab.
If you remove the ng-if from <ion-tab ng-if="displaySearchTab">...</ion-tab> the tab displays but somehow it is not registering that the displaySecondTab has been set inside the default controller.
@lvismer Your controller was tied to the wrong template view.
Check out this adjusted example:
What I did was create a new controller, and add that controller to the /app state. Now when you change the displaySearchTab variable to false, the tab won’t display. And when you set it to true, it will display.
@coen_warmer many thanks, will have a look. Will see how I transpose this to the real use case, ie. the idea is to expose the search tab only after a project has been set. So it would imply that the action for the form submit which is built via the ProjectController and app-project view will need to be the TabController.