선택기 '앱'으로 구성 요소를 선언 한 다음 다음과 같이 사용했습니다.
<app title="Awesome Title"></app>
템플릿에서 나는 이것을 썼다.
The title passed {{ title }}
구성 요소 주석 작성을 추가했습니다.
@Component({
selector: 'app',
properties: {title:'title'} // also tried ['title']
});
그러나 아무것도 나타나지 않고 출력은
The title passed
도움이 필요하세요? 감사
어떤 이유로 properties
부트 스트랩 된 루트 앱에서 작동하지 않는 것 같습니다.
'title-app'이라는 구성 요소를 만들고 'app'내부에로드 해보십시오.
// inner component
@Component({
selector: 'title-component',
properties: {title:'title'}
})
@View({ template: '<h1>{{title}}</h1>'})
class titleComponent{}
// root app
@Component({ selector: 'app' })
@View({
directives: titleComponent,
template: '<title-component [title]="Some Title"></title-component>'
})
class App{}
최신 버전의 Angular2 : 현재 alpha-26 을 사용할 수도 있습니다 . alpha-26 +에서 속성 이름이 같은 경우 한 번만 호출 할 수 있습니다.
properties: {'title': 'title'}
=> properties: 'title'
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다