javascript - ons-navigator Multiple Navigator in one page template -
i trying create app onsen ui framework. using multiple navigator. here in first page(template) works fine. pages gives error.
here error when click on google chrome console error: can not supply no "ons-page" element "ons-navigator".
here how page templates looks like:
<!-- 1 works fine --> <ons-template id="directory.html"> <ons-navigator var="app.navi"> <ons-page ng-controller="directorycontrol"> <ons-toolbar> <div class="center">directory list</div> </ons-toolbar> <ons-list> <ons-list-item modifier="chevron" class="list-item-container" ng-repeat="postcategory in postcategories"> <ons-row ng-click="setcurrentcategory(postcategory.slug); app.navi.pushpage('directory-page.html', { animation : 'slide' } )"> <ons-col> <div class="name"> {{postcategory.title}} </div> </ons-col> <ons-col width="40px"></ons-col> </ons-row> </ons-list-item> </ons-list> </ons-page> </ons-navigator> </ons-template> <!-- 1 gives error while use same method above template worked--> <ons-template id="directory-page.html"> <ons-navigator var="app.navi" > <ons-page ng-controller="directorycategorylisting"> <ons-toolbar> <div class="left"><ons-back-button>back</ons-back-button></div> <div class="center">{{currentcategory}}</div> </ons-toolbar> <ons-list> <ons-list-item modifier="chevron" class="list-item-container" ng-repeat="postdetail in postdetails"> <ons-row ng-click="setcurrentlisting(postdetail.id); app.navi.pushpage('listing-details.html', { animation : 'slide' } )"> <ons-col width="95px"> <img src="{{postdetail.attachments[0].images.square1.url}}" class="thumbnail" ng-if="postdetail.attachments[0].url != null"> <img src="images/location1.png" class="thumbnail" ng-if="postdetail.attachments[0].url == null"> </ons-col> <ons-col> <div class="name"> {{postdetail.title}} </div> <div class="desc"> {{postdetail.excerpt | htmltoplaintext}} </div> </ons-col> <ons-col width="40px"></ons-col> </ons-row> </ons-list-item> </ons-list> </ons-page> </ons-navigator> </ons-template> <!-- here want reach --> <ons-template id="listing-details.html"> <ons-page ng-controller="listingdetailsctrl" modifier="listing-details"> <ons-toolbar modifier="transparent"> <div class="right"> <ons-toolbar-button><ons-icon icon="ion-ios-chatboxes" style="color: white"></ons-icon></ons-toolbar-button> </div> </ons-toolbar> </ons-page> </ons-template>
one can not use more 1 navigator in same page?
i try solve same issue following method helped took off ons-back-button navigated page.
<ons-template id="directory-page.html"> <ons-page ng-controller="directorycategorylisting"> <ons-navigator var="categorynavi" > <ons-toolbar> <div class="left"><ons-back-button>back</ons-back-button></div> <div class="center">{{currentcategory}}</div> </ons-toolbar> <ons-list> <ons-list-item modifier="chevron" class="list-item-container" ng-repeat="postdetail in postdetails"> <ons-row ng-click="setcurrentlisting(postdetail.id); categorynavi.pushpage('listing-details.html', { animation : 'slide' } )"> <ons-col width="95px"> <img ng-src="{{postdetail.attachments[0].images.square1.url}}" class="thumbnail" ng-if="postdetail.attachments[0].url != null"> <img ng-src="images/location1.png" class="thumbnail" ng-if="postdetail.attachments[0].url == null"> </ons-col> <ons-col> <div class="name"> {{postdetail.title}} </div> </ons-col> <ons-col width="40px"></ons-col> </ons-row> </ons-list-item> </ons-list> </ons-navigator> </ons-page> </ons-template>
i bring tag inside <ons-page>
, working awesome seems <ons-back-button>back</ons-back-button>
not working after that.
any other way of doing it.
are using multiple navigators specific reason? think 1 navigator want enough. put 1 navigator in parent element ("directory.html" in code) , remove rest of them. pages call "directory.html" have access navigator, there no need create new ones. also, ons-navigator
should have ons-page
inside, don't remove or see error: can not supply no "ons-page" element "ons-navigator"
. can think in ons-navigator
"frame" content ons-page
s change depending on push/pop. don't need frame inside frame, you?
hope helps!
Comments
Post a Comment