小编bin*_*dMe的帖子

templatURL中的动态模板,角度为2

每当我必须在页面中动态包含一个模板时,我一直在使用角度1中的ng-include.

现在如何在角度2中实现这一点.我试过搜索并找到了这些:

https://groups.google.com/forum/#!topic/angular/ROkKDHboWoA,

https://github.com/angular/angular/issues/2753

有人可以解释如何在angular2中执行此操作,因为链接说由于某些安全原因不包括ng-include.

或至少如何在templateUrl属性中使用可验证的值,以便可以在服务器端处理可验证值以提供模板...

javascript angular

15
推荐指数
1
解决办法
2万
查看次数

在另一个服务角2中注入服务

我尝试使用角度为2的DI在另一个服务中注入一个服务

import {HttpService} from 'scripts/httpService';
export class CurrentBlog{
    constructor(public httpService:HttpService){}
}
Run Code Online (Sandbox Code Playgroud)

当我这样做时,我收到此错误:

无法解析CurrentBlog(?)的所有参数.确保它们都具有有效的类型或注释.

我用正常组件测试了DI,它工作正常.但是当我注入服务时.它根本不起作用.

typescript angular

5
推荐指数
1
解决办法
2181
查看次数

标签 统计

angular ×2

javascript ×1

typescript ×1