的函數嗯......在角1.x.y是templateUrl在angular2
angular.module('myApp', []).directive('myDirective', function(){
return {
templateUrl : function(tElement, iAttrs){
return 'http://' + iAttrs.myDirective // More...
}
}
});
但是...在Angular2
@Component({
selector: 'my-Directive',
templateUrl: 'http://???'
})
class HelloWorld {
}
那麼,在doc說只有一個String
。因爲它被處理爲angular2中的函數?
使用templateUrl: 'HTTP:// ...' – pixelbits
同類爲[這個問題(類似的問題的http://stackoverflow.com/questions/36071097/how-can -i-have-dynamic-templateurl-for-angular2-component)沒有答案... –
@pixelbits OP想擁有基於從父組件傳遞的值的動態'templateUrl' ..我昨天問過類似的問題,但didn找不到任何答案..你能看看我以前的評論嗎? –