3

I am trying to use components (instead of controllers and templates) in ui-router. But this isn't working.
I'm following this article from their website.
Plunk

html:

  <body ng-app="myApp">
    <h1>Help!</h1>
    <a ui-sref="mypage">mypage</a>
    <ui-view></ui-view>
  </body>

js:

// Register
angular.module('myApp', ['ui.router']);

// config
angular.module('myApp').config(function($stateProvider) {
  $stateProvider.state({
    name: 'mypage',
    url: '/mypage',
    component: "newComponent" // cant use this.
  })
});

//component
angular.module('myApp').component('newComponent', {
  template: "<h1> THis is from component <h1>"
});

I'm neither getting the result, nor any errors. What I'm missing here?
Thanks in advance.

1
  • 1
    switch versions on right side of plunker and click libraries works fine here Commented Oct 1, 2016 at 18:42

1 Answer 1

1

You don't have the right version.

Get the beta one:

npm install --save [email protected]

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.