Angular 4.html Component problem

Asked

Viewed 585 times

0

I have a small problem, I started my studies in Angular, I’m still understanding the functioning of modules, components and services. But when I put an html structure in Component.html, it simply doesn’t show anything on the page, if I delete that structure and just put one div with bootstrap, it shows on the screen. How can I solve this ? I already took the tag from the selector and put it in the app.component.html

   Div com bootstrap sendo mostrada em tela.

<div class="container">
  <div class="row">
    <p>teste</p>
  </div>
</div>

Estrutura html que não aparece em tela, localizada no teste.component.html. Exp:

<html>
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Page Title</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" type="text/css" media="screen" href="main.css" />
  <script src="main.js"></script>

</head>

<body>
<p>Teste</p>
</body>
</html>> 

  • Your app.component.html has an element <router-output> no body? Are the routes correct? How is the component problem defined? Will I need more code.

1 answer

-2

Apparently in your code you have an > the most at the end of </html>> remove and try again, this test.component.html doesn’t need to <html> <head> ... because this already has in index.html, is a code that will be added in the middle of the page, an injection of HTML ...

  • You have enough reputation to post comments on the other questions and make an answer with the text of a comment?

  • 1

    This does not provide an answer to the question. To criticize or request clarification from an author, leave a comment below its publication. - Of Revision

  • @Rbz remade the answer, was wrong by the comment in the reply.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.