2016-10-01 6 views
3

ui-router에 components (대신 controllerstemplates)을 사용하려고합니다. 그러나 이것은 효과가 없습니다.
나는 그들의 웹 사이트에서 this 문서를 팔로우하고 있습니다.
Plunk

HTML :각도 구성 요소를 ui-router와 함께 사용하는 방법은 무엇입니까?

<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>" 
}); 

나는 어느 결과를 얻기 않으며, 오류 있어요. 여기서 내가 놓친 게 뭐야?
미리 감사드립니다.

+1

스위치 버전을 설치하고 [작동 여기에 고급] (HTTPS ://plnkr.co/edit/Cpph8siwPTnJYf5ihniO?p=preview) – charlietfl

답변

관련 문제