0

I am using like this in my .html file,but it is not working.

 <p>State is {{state.current.name}}</p>

In controller.js i am able to get it. But I want to get it in html file. Anyone can help me in this.

ananya
  • 1,001
  • 6
  • 33
  • 50

1 Answers1

4

in controller assign state to a variable

$scope.state = $state;

Now you can access it in the HTML.

<p>State is {{state.current.name}}</p>

Make sure to inject $state into controller.

Omar Einea
  • 2,478
  • 7
  • 23
  • 35
Sachila Ranawaka
  • 39,756
  • 7
  • 56
  • 80
  • Thank You @Sachila Ranawaka .It is working. Can you please look into below link and help me out how to do this? https://stackoverflow.com/questions/48020325/show-only-one-icon-in-one-common-headerbar-in-angularjs-and-ionic-v1 – ananya Dec 29 '17 at 15:05