2016-07-26 69 views

回答

1

的解決方案,從這個github issue

declare var __moduleName: string; 

@Component({ 
    selector: 'my-component', 
    moduleId: __moduleName, 
    templateUrl: './my.component.html' 
}) 
export class MyComponent { } 
+0

感謝您將此引起我的注意。如果其他人正在考慮採用這種解決方法,就像我一樣,@ Hernan的答案中的鏈接討論了爲什麼這種攻擊被認爲是必要的。例如,請參閱5月28日robwormald的評論。如果您只是在尋找解決方法的權威性聲明,請參閱8月7日mlc-mlapis的最終評論,該鏈接位於同一個GitHub鏈接中。我喜歡在聲明中使用'const'而不是'var'。 –