Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

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.

share|improve this question
    
switch versions on right side of plunker and click libraries works fine here – charlietfl 23 hours ago

You don't have the right version.

Get the beta one:

npm install --save [email protected]

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.