ngControlnew Control('', Validators.required)即使文件有效,值也不起作用.
(实际上,我发现很难验证单选按钮......)
当我们想到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 ×2