【发布时间】:2018-12-20 00:39:28
【问题描述】:
我正在制作简单的应用程序,现在有 3 个组件,一个称为 MAIN COMPONENT 的父组件和两个子组件,其中一个子组件正在显示选定的车辆并且工作正常,但是选择完成后我需要点击我的应用程序中的添加按钮,打开模式(这是另一个组件),我应该在其中选择一个客户/客户,以便我可以标记该车辆是选定的客户所有权。
一般情况下是这样的:
所以基本上当单击添加按钮时(添加按钮是工具箱组件的一部分),应该显示模态(另一个包含客户的组件),我可以在其中选择客户端。
按下 add 时应该显示的组件是:customer.component.html
现在我将发布我的代码:
1.) 应该持有客户customer.component.html的发布组件@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Clients</h4>
</div>
<div class="modal-body item-edit-container">
<h4 class="modal-title" style="text-align: center;">Find client by ID</h4>
<div class="form-group">
<input type="text" class="form-control dash-form-control" id="" placeholder="" autofocus>
<div style="margin-top: 10px;">
<select class="form-control dash-form-control select2" style="width: 100%;">
<option selected disabled>Search for client..</option>
<option>Person 1</option>
<option>Person 2</option>
<option>Person 3</option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn save-keyboard-btn" data-dismiss="modal"></button>
</div>
</div>
@Component({
selector: 'app-customer',
templateUrl: './customer.component.html',
styleUrls: ['./customer.component.css']
})
export class ClientComponent implements OnInit {
ngOnInit() {
}
}
我一般不知道应该怎么做,也许我应该在我的主要组件上放置这样的东西:
<app-customer></app-customer> and somehow show it when I click on button add, but I really don't know how to achieve this? Could anyone write me some simple steps which I might follow or whatever...
谢谢大家 干杯
所以请记住我最后的问题很简单,我需要显示一个模式,在单击按钮时代表我的组件..
谢谢 干杯
【问题讨论】:
标签: javascript jquery angular bootstrap-modal angular-components