小编chi*_*uma的帖子

如何使用Angular2验证<input type ="file">?

ngControlnew Control('', Validators.required)即使文件有效,值也不起作用.

(实际上,我发现很难验证单选按钮......)

angular

14
推荐指数
1
解决办法
8003
查看次数

Angular2中$ templateCache的替代方案

当我们想到template在Angular2或Angular1.X 中使用时,我们知道下面是基本的写作方式之一:

template: './template-ninja.html'

使用Angular1.X,我们可以预先缓存所有模板,$templateCache.put()如下所示:

var myApp = angular.module('Ninja', []);
myApp.run(function($templateCache) {
  $templateCache.put('templateNinja.html', 'This is the content of the template-ninja');
});
Run Code Online (Sandbox Code Playgroud)

这将减少http请求的数量.我想知道如何使用Angular2实现相同的功能.有人可以帮忙吗?谢谢.

angular

13
推荐指数
1
解决办法
5343
查看次数

标签 统计

angular ×2