/**
* Creates an LContainer for an ng-template (dynamically-inserted view), e.g.
*
*
*
*
*
* \@codeGenApi
* @param {?} index The index of the container in the data array
* @param {?} templateFn Inline template
* @param {?} decls The number of nodes, local refs, and pipes for this template
* @param {?} vars The number of bindings for this template
* @param {?=} tagName The name of the container element, if applicable
* @param {?=} attrsIndex Index of template attributes in the `consts` array.
* @param {?=} localRefsIndex
* @param {?=} localRefExtractor A function which extracts local-refs values from the template.
* Defaults to the current element associated with the local-ref.
*
* @return {?}
*/
function ɵɵtemplate(index, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex, localRefExtractor) {
/** @type {?} */
const lView = getLView();
/** @type {?} */
const tView = getTView();
/** @type {?} */
const adjustedIndex = index + HEADER_OFFSET;
/** @type {?} */
const tNode = tView.firstCreatePass ?
templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) :
(/** @type {?} */ (tView.data[adjustedIndex]));
setPreviousOrParentTNode(tNode, false);
/** @type {?} */
const comment = lView[RENDERER].createComment(ngDevMode ? 'container' : '');
appendChild(tView, lView, comment, tNode);
attachPatchData(comment, lView);
addToViewTree(lView, lView[adjustedIndex] = createLContainer(comment, lView, comment, tNode));
if (isDirectiveHost(tNode)) {
createDirectivesInstances(tView, lView, tNode);
}
if (localRefsIndex != null) {
saveResolvedLocalsInData(lView, tNode, localRefExtractor);
}
}Angular调用指令的工厂函数生成新的实例,
自定义指令的属性和构造函数在指令工厂里被调用: