Angular7 component is not shown correctly (and toggle does not work)

Multi tool use
Multi tool use












1














I've been trying for hours to understand what's happening here, but I didn't manage to understand.
I've written the html body for a navigation bar, which is shown below.



<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>


<nav class="navbar navbar-inverse">
<div class = "container-fluid">

<div class = "navbar-header">
<button class="navbar-toggle" data-toggle="collapse" data-target="#navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="#" class="navbar-brand">Segmentation Folks</a>
</div>

<div class = "collapse navbar-collapse" id="navHeaderCollapse">
<ul class = "nav navbar-nav">
<li style="text-align: center;"><a href ="#">Home</a></li>
<li style="text-align: center;"><a href ="#">About</a></li>
<li style="text-align: center;"><a href ="#">Contact</a></li>
<li style="text-align: center;"><a href ="#">Sign in</a></li>
<li style="text-align: center;"><a href ="#">Sign up</a></li>
</ul>
</div>
</div>
</nav>


When I open the html file from my computer, they all seem to be as I want.



But when I copied the html body to be an Angular component, the result is this. In addition the toggle button when the screen is small does not work, while in html it works.



Do you know why this happens? Thank you!



EDIT!
I have installed the bootstrap 3.3.6 and I have removed the scripts and link from this html. Then I included in the index.html below the the following:



<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>


It seems that now it works!










share|improve this question





























    1














    I've been trying for hours to understand what's happening here, but I didn't manage to understand.
    I've written the html body for a navigation bar, which is shown below.



    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>


    <nav class="navbar navbar-inverse">
    <div class = "container-fluid">

    <div class = "navbar-header">
    <button class="navbar-toggle" data-toggle="collapse" data-target="#navHeaderCollapse">
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    </button>
    <a href="#" class="navbar-brand">Segmentation Folks</a>
    </div>

    <div class = "collapse navbar-collapse" id="navHeaderCollapse">
    <ul class = "nav navbar-nav">
    <li style="text-align: center;"><a href ="#">Home</a></li>
    <li style="text-align: center;"><a href ="#">About</a></li>
    <li style="text-align: center;"><a href ="#">Contact</a></li>
    <li style="text-align: center;"><a href ="#">Sign in</a></li>
    <li style="text-align: center;"><a href ="#">Sign up</a></li>
    </ul>
    </div>
    </div>
    </nav>


    When I open the html file from my computer, they all seem to be as I want.



    But when I copied the html body to be an Angular component, the result is this. In addition the toggle button when the screen is small does not work, while in html it works.



    Do you know why this happens? Thank you!



    EDIT!
    I have installed the bootstrap 3.3.6 and I have removed the scripts and link from this html. Then I included in the index.html below the the following:



    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>


    It seems that now it works!










    share|improve this question



























      1












      1








      1







      I've been trying for hours to understand what's happening here, but I didn't manage to understand.
      I've written the html body for a navigation bar, which is shown below.



      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
      <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>


      <nav class="navbar navbar-inverse">
      <div class = "container-fluid">

      <div class = "navbar-header">
      <button class="navbar-toggle" data-toggle="collapse" data-target="#navHeaderCollapse">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      </button>
      <a href="#" class="navbar-brand">Segmentation Folks</a>
      </div>

      <div class = "collapse navbar-collapse" id="navHeaderCollapse">
      <ul class = "nav navbar-nav">
      <li style="text-align: center;"><a href ="#">Home</a></li>
      <li style="text-align: center;"><a href ="#">About</a></li>
      <li style="text-align: center;"><a href ="#">Contact</a></li>
      <li style="text-align: center;"><a href ="#">Sign in</a></li>
      <li style="text-align: center;"><a href ="#">Sign up</a></li>
      </ul>
      </div>
      </div>
      </nav>


      When I open the html file from my computer, they all seem to be as I want.



      But when I copied the html body to be an Angular component, the result is this. In addition the toggle button when the screen is small does not work, while in html it works.



      Do you know why this happens? Thank you!



      EDIT!
      I have installed the bootstrap 3.3.6 and I have removed the scripts and link from this html. Then I included in the index.html below the the following:



      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
      <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>


      It seems that now it works!










      share|improve this question















      I've been trying for hours to understand what's happening here, but I didn't manage to understand.
      I've written the html body for a navigation bar, which is shown below.



      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
      <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>


      <nav class="navbar navbar-inverse">
      <div class = "container-fluid">

      <div class = "navbar-header">
      <button class="navbar-toggle" data-toggle="collapse" data-target="#navHeaderCollapse">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      </button>
      <a href="#" class="navbar-brand">Segmentation Folks</a>
      </div>

      <div class = "collapse navbar-collapse" id="navHeaderCollapse">
      <ul class = "nav navbar-nav">
      <li style="text-align: center;"><a href ="#">Home</a></li>
      <li style="text-align: center;"><a href ="#">About</a></li>
      <li style="text-align: center;"><a href ="#">Contact</a></li>
      <li style="text-align: center;"><a href ="#">Sign in</a></li>
      <li style="text-align: center;"><a href ="#">Sign up</a></li>
      </ul>
      </div>
      </div>
      </nav>


      When I open the html file from my computer, they all seem to be as I want.



      But when I copied the html body to be an Angular component, the result is this. In addition the toggle button when the screen is small does not work, while in html it works.



      Do you know why this happens? Thank you!



      EDIT!
      I have installed the bootstrap 3.3.6 and I have removed the scripts and link from this html. Then I included in the index.html below the the following:



      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
      <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>


      It seems that now it works!







      html css angular angular7






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday

























      asked yesterday









      christouandr7

      65




      65
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Instead use links use cli to install bootstrap .



          But to install 3.3.6 use this command:



          npm install bootstrap@3.3.6


          Here is working code



          EDIT MAKE COLLAPSE WORK WITH ANGULAR



          add in ts



          collapsed:boolean=true;


          html



          <nav class="navbar navbar-inverse">
          <div class = "container-fluid">

          <div class = "navbar-header">
          <button class="navbar-toggle" data-toggle="collapse" data-target="#navHeaderCollapse" (click)="collapsed = !collapsed;">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          </button>
          <a href="#" class="navbar-brand">Segmentation Folks</a>
          </div>

          <div class = "collapse navbar-collapse" id="navHeaderCollapse" [ngClass]="{'collapse': collapsed, 'navbar-collapse': true}">
          <ul class = "nav navbar-nav">
          <li style="text-align: center;"><a href ="#">Home</a></li>
          <li style="text-align: center;"><a href ="#">About</a></li>
          <li style="text-align: center;"><a href ="#">Contact</a></li>
          <li style="text-align: center;"><a href ="#">Sign in</a></li>
          <li style="text-align: center;"><a href ="#">Sign up</a></li>
          </ul>
          </div>
          </div>
          </nav>





          share|improve this answer























          • it seems that the design is ok now, but the toggle button still does not work. any idea for this?
            – christouandr7
            yesterday










          • see my edit please
            – לבני מלכה
            yesterday











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53944096%2fangular7-component-is-not-shown-correctly-and-toggle-does-not-work%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Instead use links use cli to install bootstrap .



          But to install 3.3.6 use this command:



          npm install bootstrap@3.3.6


          Here is working code



          EDIT MAKE COLLAPSE WORK WITH ANGULAR



          add in ts



          collapsed:boolean=true;


          html



          <nav class="navbar navbar-inverse">
          <div class = "container-fluid">

          <div class = "navbar-header">
          <button class="navbar-toggle" data-toggle="collapse" data-target="#navHeaderCollapse" (click)="collapsed = !collapsed;">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          </button>
          <a href="#" class="navbar-brand">Segmentation Folks</a>
          </div>

          <div class = "collapse navbar-collapse" id="navHeaderCollapse" [ngClass]="{'collapse': collapsed, 'navbar-collapse': true}">
          <ul class = "nav navbar-nav">
          <li style="text-align: center;"><a href ="#">Home</a></li>
          <li style="text-align: center;"><a href ="#">About</a></li>
          <li style="text-align: center;"><a href ="#">Contact</a></li>
          <li style="text-align: center;"><a href ="#">Sign in</a></li>
          <li style="text-align: center;"><a href ="#">Sign up</a></li>
          </ul>
          </div>
          </div>
          </nav>





          share|improve this answer























          • it seems that the design is ok now, but the toggle button still does not work. any idea for this?
            – christouandr7
            yesterday










          • see my edit please
            – לבני מלכה
            yesterday
















          0














          Instead use links use cli to install bootstrap .



          But to install 3.3.6 use this command:



          npm install bootstrap@3.3.6


          Here is working code



          EDIT MAKE COLLAPSE WORK WITH ANGULAR



          add in ts



          collapsed:boolean=true;


          html



          <nav class="navbar navbar-inverse">
          <div class = "container-fluid">

          <div class = "navbar-header">
          <button class="navbar-toggle" data-toggle="collapse" data-target="#navHeaderCollapse" (click)="collapsed = !collapsed;">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          </button>
          <a href="#" class="navbar-brand">Segmentation Folks</a>
          </div>

          <div class = "collapse navbar-collapse" id="navHeaderCollapse" [ngClass]="{'collapse': collapsed, 'navbar-collapse': true}">
          <ul class = "nav navbar-nav">
          <li style="text-align: center;"><a href ="#">Home</a></li>
          <li style="text-align: center;"><a href ="#">About</a></li>
          <li style="text-align: center;"><a href ="#">Contact</a></li>
          <li style="text-align: center;"><a href ="#">Sign in</a></li>
          <li style="text-align: center;"><a href ="#">Sign up</a></li>
          </ul>
          </div>
          </div>
          </nav>





          share|improve this answer























          • it seems that the design is ok now, but the toggle button still does not work. any idea for this?
            – christouandr7
            yesterday










          • see my edit please
            – לבני מלכה
            yesterday














          0












          0








          0






          Instead use links use cli to install bootstrap .



          But to install 3.3.6 use this command:



          npm install bootstrap@3.3.6


          Here is working code



          EDIT MAKE COLLAPSE WORK WITH ANGULAR



          add in ts



          collapsed:boolean=true;


          html



          <nav class="navbar navbar-inverse">
          <div class = "container-fluid">

          <div class = "navbar-header">
          <button class="navbar-toggle" data-toggle="collapse" data-target="#navHeaderCollapse" (click)="collapsed = !collapsed;">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          </button>
          <a href="#" class="navbar-brand">Segmentation Folks</a>
          </div>

          <div class = "collapse navbar-collapse" id="navHeaderCollapse" [ngClass]="{'collapse': collapsed, 'navbar-collapse': true}">
          <ul class = "nav navbar-nav">
          <li style="text-align: center;"><a href ="#">Home</a></li>
          <li style="text-align: center;"><a href ="#">About</a></li>
          <li style="text-align: center;"><a href ="#">Contact</a></li>
          <li style="text-align: center;"><a href ="#">Sign in</a></li>
          <li style="text-align: center;"><a href ="#">Sign up</a></li>
          </ul>
          </div>
          </div>
          </nav>





          share|improve this answer














          Instead use links use cli to install bootstrap .



          But to install 3.3.6 use this command:



          npm install bootstrap@3.3.6


          Here is working code



          EDIT MAKE COLLAPSE WORK WITH ANGULAR



          add in ts



          collapsed:boolean=true;


          html



          <nav class="navbar navbar-inverse">
          <div class = "container-fluid">

          <div class = "navbar-header">
          <button class="navbar-toggle" data-toggle="collapse" data-target="#navHeaderCollapse" (click)="collapsed = !collapsed;">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          </button>
          <a href="#" class="navbar-brand">Segmentation Folks</a>
          </div>

          <div class = "collapse navbar-collapse" id="navHeaderCollapse" [ngClass]="{'collapse': collapsed, 'navbar-collapse': true}">
          <ul class = "nav navbar-nav">
          <li style="text-align: center;"><a href ="#">Home</a></li>
          <li style="text-align: center;"><a href ="#">About</a></li>
          <li style="text-align: center;"><a href ="#">Contact</a></li>
          <li style="text-align: center;"><a href ="#">Sign in</a></li>
          <li style="text-align: center;"><a href ="#">Sign up</a></li>
          </ul>
          </div>
          </div>
          </nav>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited yesterday

























          answered yesterday









          לבני מלכה

          9,2861726




          9,2861726












          • it seems that the design is ok now, but the toggle button still does not work. any idea for this?
            – christouandr7
            yesterday










          • see my edit please
            – לבני מלכה
            yesterday


















          • it seems that the design is ok now, but the toggle button still does not work. any idea for this?
            – christouandr7
            yesterday










          • see my edit please
            – לבני מלכה
            yesterday
















          it seems that the design is ok now, but the toggle button still does not work. any idea for this?
          – christouandr7
          yesterday




          it seems that the design is ok now, but the toggle button still does not work. any idea for this?
          – christouandr7
          yesterday












          see my edit please
          – לבני מלכה
          yesterday




          see my edit please
          – לבני מלכה
          yesterday


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53944096%2fangular7-component-is-not-shown-correctly-and-toggle-does-not-work%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          OdFBAjFjrnrLfo7 r6F EGWmCs3K 73nEctVb1L g
          kBlELg1xt,eRmNp1jF 13q2qS s90Fi

          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas