Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

v0.9.3 Angular and Bootstrap issues #960

@ghost

Description

Spent ages on this today trying to figure what I'd broken upgrading from Angular 2 to 4. Hopefully someone will have an idea what I'm missing or it at least helps someone else...

Repro:

Download aspnetcore-spa v0.9.1 (Angular 2.4.5)
Remove all the html content from a file eg. \ClientApp\app\components\counter\counter.component.html
and copy and paste the below from https://www.w3schools.com/bootstrap/bootstrap_modal.asp

<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Modal Header</h4>
      </div>
      <div class="modal-body">
        <p>Some text in the modal.</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>

Click the button and note a modal dialog appears

Do the same thing on v0.9.3 (Angular 4.1.2) as above
Note now that when clicking on the button the bootstrap modal dialog now doesn't work

Finally I found that adding the below makes it work, but I don't understand why when both Bootstrap and JQuery are both in package.json

Copy this into index.cshtml in your 0.9.3 project

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.js" type="text/javascript"></script>

and now it works in Angular 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions