Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

How do you get state.data in template?

$
0
0

@smth wrote:

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?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>