2017-08-29 10 views
1

私はこのようなコンポーネントをインスタンス化するだけでカスタム属性を使用したいと思います:コードのDIVタグ属性を持つAngularJSコンポーネントを初期化するにはどうすればよいですか?

index.htmlを

<div evaluation-paste></div> 

レクリエーション:

evaluation.paste.ts

export const evaluationPasteComponent: angular.IComponentOptions = { 
    template: require('./evaluation.paste.html'), 
}; 

evalutaion.paste.html

<div class="row"> 
    paste component 
</div> 

index.ts

import * as angular from 'angular'; 
import { EvaluationController } from './evaluation.controller'; 
import { evaluationPasteComponent } from './evaluation.paste'; 
import { evaluationParseComponent } from './evaluation.parse'; 
import { evaluationSummaryComponent } from './evaluation.summary'; 


const evaluationComponent: angular.IComponentOptions = { 
    template: require('./evaluation.html'), 
    controller: EvaluationController, 
    controllerAs: 'evaluation' 
}; 

export const evaluationModule = 'evaluation'; 

angular.module(evaluationModule, []) 
    .component('evaluationPaste', evaluationPasteComponent) 
    .component('evaluationParse', evaluationParseComponent) 
    .component('evaluationSummary', evaluationSummaryComponent) 
    .component('evaluation', evaluationComponent); 

私はこのようにそれを行うと、私は "ペースト成分" のテキストが表示されません。

しかし、私はカスタム要素でそれを行うと動作します。

<evaluation-paste ng-show="evaluation.step == 'paste'"></evaluation-paste> 

しかし、私はDIVが必要です。

答えて

関連する問題