Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

How do you get state.data in template?

$
0
0

Hi

I'm just using ionic / angular for the first time. I've started out with the "sidemenu" app and I'm trying to pass some variables from the various states to a template. So far, in app.js I've got:

.state('app.example', {
  url: '/example',
  views: {
    'menuContent': {
      templateUrl: 'templates/example.html',
      data: {
        customData1: "var one",
        customData2: "var two"
      }
    }
  }
})

and in templates/example.html I've got

<ion-view view-title="Example">
  <ion-content>
    <h1>Example</h1>
    {{$state.current.data.customData1}}
 </ion-content>
</ion-view>

but that appears to be undefined. Any pointers?


Viewing all articles
Browse latest Browse all 228595

Trending Articles