javascript - ui-router in ionic framework issue -
I have a problem getting my routes to match with my ideas I have the following routes: / P>
.state ('tab.account', {url: '/ account', abstract: true, views: {'tab-account': {templateUrl: '(' Tab.account.order ', {Url:' / order /: id ', view: {' order-view ':}' order-view ': {Template URL:' Template / Order-View HTM ', Controller:' Order Controller '}} }) I have this templates / tab-account
& lt; ion-view head Logic = "Account" & gt; & lt; ion-content class = "has-header padding"> account & lt; / h1 & gt; & lt; h2 & gt; your order & Lt; / h2 & gt; div class = "card" ng-repeat = "booking in booking" & gt; div class = "item-text-wrap"> gt; & lt; b & Gt; & lt; a ng-click = "view order (booking.id)" & gt; {{booking.carpark.city}} & lt; / a & gt; & lt; / b & gt; Lt; b & gt; {{booking.date | Date: 'dd.mm.yyyy'}}
I have that view in the controller for:
$ scope.viewOrder = function (id) {$ State .go ('tab.account.order', {id: id}); }; Then finally I have the view for this order:
& Lt; / Ion content & gt;
The URL starts working, I end up with the # / tab / account / order / 1 but it does not load the final view!
Cheers in advance!
UI-router configuration will depend on what you are trying to do.
It seems that you want to view the account and see the order view on different pages, in which case you would not want to consider it an intangible state, because: "an abstract state has a child States can be but can not meet a 'Saras' state is the only state which can not be transmitted. "
I am not sure that you have a child for the same reason Want the state of "because State Load your templates in the UI-view of their parents. "().
If this is the case, then you can do something like this:
.state ('tab.account', {url: '/ account', TemplateUrl: Templates / tab-account.html ', Controller:' Account Controller '}) .state (' tab.order ', {url:' / account / order /: id ', templateUrl:' Templates / order-view .html ', Controller: 'Order Controller'}) Here's a planner:
Objects have been removed because you do not really need them to have several nested views.
If you wanted to see the order on the same page, then you can do something like this:
& Lt; H2 & gt; Your order & lt; / H2 & gt; & Lt; Div class = "card" ng-repeat = "booking in booking" & gt; & Lt; Div class = "item-text-wrap" & gt; & Lt; B & gt; & Lt; An NG-Click = "View Order (Booking. ID)" & gt; {{Booking.carpark.city}} & lt; / A & gt; & Lt; / B & gt; On & lt; B & gt; {{Booking.date | Date: 'dd.mm.yyyy'}} & lt; / B & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Ui-View & gt; & Lt; / Ui-view & gt; & Lt ;! - where the child will load the scene - & gt; & Lt; / Ion content & gt; & Lt; / Ion-view & gt; app.js:
.state ('tab.account', {url: '/ account', templateURL: 'tab-account.html ', Administrator:' account controller '}) .state (' tab.account.order ', {url:' / order /: id ', templateUrl:' order-view.html ', controller:' command controller '}) / Code> You might want to remove your ion-content from the templates to see the order, otherwise you can get some firing double-scroll issues. Hope it helps! The Ui-router is very confusing, but their wiki has some great documents and examples that make things clean.
Comments
Post a Comment