我正在尝试创建一个弹出窗口,询问按钮单击时的登录详细信息.
我的app.component看起来像
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: `mytemplate.html`
})
export class AppComponent {}
Run Code Online (Sandbox Code Playgroud)
在index.html中,我引用了jquery和bootstrap
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
Run Code Online (Sandbox Code Playgroud)
mytemplate.html:
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">start here</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">×</button>
<h4 class="modal-title">Login</h4>
</div>
<div class="modal-body">
<form id="login-form">
<div class="modal-body">
<input id="username" type="text" placeholder="Username" >
<input id="password" type="password" placeholder="Password">
</div>
<div class="modal-footer">
<div>
<button type="submit" …Run Code Online (Sandbox Code Playgroud)