M
M
Maxim2017-09-27 16:06:57
JavaScript
Maxim, 2017-09-27 16:06:57

How to render a component within a component?

There is a component

'use strict';

angular
    .module('buzz')
    .component('commonHeader', {
        templateUrl: "/views/header.html",
        controller: function ($scope, globalRatingApiService) {}
    .component('leftBlock', {
    templateURL: "/views/headerLeft.html",
    controller: function () {
      console.log('ASD');
        }

A component has been added to index.html Another component has been added to header.html If templateUrl is replaced with template: "" in leftBlock , then the tag is displayed in the dom, but is not pulled from the template, why is that?
<common-header></common-header>
<left-block></left-block>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
ozknemoy, 2017-09-30
@ozknemoy

everything is correct. template: "" says that the content is empty. if you do not specify a template at all, then it will be taken from the fact that between the tags and

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question