How to disable the header button?


#1

I have the form and the submit button on the header,

I can no t get the scope of form in header buttons?

Any suggession how to disalbe the button when form is invalid ?

I use ng-cordova for disable /enable the form , but could not get the form in the header button.


#2

It can be done easily, you just need to play a bit.

Let header bar have its own controller.

Also if you already don’t have it create a factory object and within it create a variable both original controller and new header controller will see. When you want to disable header button just set factory variable to whatever you need and let header controller watch for changes on that variable.

For more information open this article: http://www.gajotres.net/ionic-framework-tutorial-9-passing-data-between-pages/
and search for chapter: Manual Data Sharing Between Controllers. You’ll find a working example.


#3

Setting the controller on the state and then setting ion-nav-bar with a button with ng-class doesn work? I had some problems with ng-if but not with them being out of reach.


#4

@Gajotres
Yes that is the one solution ,
But this will create one extra watcher for the every page I need this only for the one registration page ?