monaca - How to update onsen-ui states? -
I have a simple onsen-UI sample page. It is made in Onenan (UI) 1.0.4 with Maneka ().
This page has two onsen-ui buttons (on-buttons), their visibility is bound by the JavaScript method via angular JS but the buttons are mutually exclusive, which means that button 1 is visible, Button 2 should be hidden - and on the other side.
Whenever a button is clicked, an internal flag is changed and the second button is displayed.
The problem is: When the page is first loaded, the visibility of the button is not implemented properly. This only works when a user clicks on a button manually.
As a counter example, there are two general HTML buttons on the page - these buttons work properly when page loads.
Can you give me some advice?
HTML code:
& lt; Div ng-controller = "AppCtrl" & gt; & Lt; Strong & gt; Click to toggle & lt; / Strong> & Lt; Br> & Lt; Button ng-click = "starttracking ()" ng-hide = "hatcockingering ()" & gt; & Lt; Strong & gt; On & lt; / Strong> & Lt; / Button & gt; & Lt; Button ng-click = "stoptracking ()" ng-show = "hatcrackerring ()" & gt; & Lt; Strong & gt; Off of & lt; / Strong> & Lt; / Button & gt; & Lt; Ons-button ng-click = "startautracking ()" ng-hide = "isTrackingRunning ()" & gt; Start tracking & lt; / Ons-button & gt; & Lt; Ons-button ng-click = "stopTracking ()" ng-show = "hatcockingering ()" & gt; Stop tracking & lt; / Ons-button & gt; & Lt; / Div & gt;
JS code:
Angular Modules ('Sotramon', ['Onson DICIR']). Controller ('apctn', ['$ scope', function ($ scope) {var tracking-ringing = wrong; $ scope.isTrackingRunning = function () {console.log ("getter is called, coming back" + tracking turned on Is running); Tracking backtrack;} $ scope.startTracking = function () {TrackingRunning = true;} $ scope.stopTracking = function () {trackingRunning = false;}}]));
I can reproduce on Onsen UI 1.0.4. External solution tags
& lt; Span ng-hide = "isTrackingRunning ()" & gt; & Lt; Ng-click ons-button = "startautracking ()" & gt; There is a solution to start tracking & lt; / On-button & gt; & Lt; / Span & gt; & Lt; Span ng-show = "isTrackingRunning ()" & gt; & Lt; On-button ng-click = "stoptracking ()" & gt; Stop tracking & lt; / Ons-button & gt; & Lt; / Span & gt;
Comments
Post a Comment