- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我的 ngForm 中有一些字段。所有标签和输入都对齐在一条直线上(垂直)。我希望它采用两列的形式,例如右侧的“处方详细信息”和左侧的“症状”。右上角的日期。
我尝试了不同的样式,例如位置和文本对齐,但都没有用。
代码如下:
<div class="row">
<div class="column" style="padding: 7.5%" >
<form #institutesForm="ngForm" (ngSubmit)="instituteLogins(institutesForm)">
<div class="form-group">
<label> <strong>Date</strong> </label>
<input type="date" name="date" id="date" class="form-control" [(ngModel)]="institutes.date">
<br>
<h2> <strong> Patient Problems</strong></h2>
<label><strong> Symtoms</strong> </label>
<input type="text" name="symtoms" id="symtoms" class="form-control"[(ngModel)]="institutes.symtoms">
<label><strong>Allergy</strong> </label>
<input type="text" name="allergy" id="allergy" class="form-control"[(ngModel)]="institutes.allergy">
<br>
<h2><strong>Diagnosis</strong></h2>
<label> <strong>Condition</strong> </label>
<input type="text" name="condition" id="condition" class="form-control"[(ngModel)]="institutes.condition">
<label><strong> Advice </strong></label>
<input type="text" name="advice" id="advice" class="form-control"[(ngModel)]="institutes.advice">
<br>
<h2> <strong>Prescription</strong> </h2>
<br>
<label><strong> Medication </strong></label>
<input type="text" name="medication" id="medication" class="form-control"[(ngModel)]="institutes.medication">
<label><strong>Course</strong></label>
<input type="text" id="course" name="course" class="form-control"[(ngModel)]="institutes.course">
<br><br>
</div>
<button id="record" class="btn btn-primary" type="submit" >Add Record</button> </form>
</div>
</div>
有可能吗?
最佳答案
根据你的描述,我不太确定你在布局细节方面的意思,但总而言之,我觉得你应该逐步淘汰 Bootstrap 并使用 CSS Grid
,这允许我们定义我们自己的网格以及该网格的指定区域,我们可以使用这些区域将我们的元素限制在那些定义的空间内。我做了一个简单的demo给大家看看here查看 div
是如何被它们的类限制在页面的某些部分的。您也可以在子元素上创建网格。它会让您的生活更轻松,您的代码也更清晰。
关于html - 在 Angular2 中对齐 ngForm 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58900775/
在 Angular 1 (1.5) 中,表单 Controller 有一个 $setSubmitted()允许您以编程方式设置 .$submitted 的方法标记为真。 如何通过 NgForm 对象在
我是 Angular 的新手,我正在使用模板驱动的表单。当我使用 NgForm 时,它抛出错误: src/app/pages/add-booking/servicing/servicing.compo
我是 Angular 的新手,我正在使用模板驱动的表单。当我使用 NgForm 时,它抛出错误: src/app/pages/add-booking/servicing/servicing.compo
我正在尝试制作一个包含两个不同组件的表单。一位家长和一位 child 。我查看了很多教程,他们都在谈论提供服务。 不过,我在这个website上找到了一个方法.它包括在子组件中添加以下内容: view
我遇到了以下问题。我想使用 NG2 Forms。根据 Angular 2 文档,在表单上使用 ngForm 指令并在输入上使用 ngControl 指令,表单应该始终能够访问输入的有效性。 如果输入与
我有简单的形式 Is required lol 和组件作为 export class InputOverviewExample { comm
我最近一直在使用 React,并且非常喜欢它,但我错过了一些我在其他框架中习惯的东西。 ngForm 中主要的一个来自 Angular,Angular 使用它来提供非常简单的表单验证。检查表单是否有效
当我提交表单时,我有这个功能 login(form: NgForm) 如果我尝试以下操作 console.log(form.value.password); // this works perfect
我是 Angular 初学者,我正在尝试打印在控制台中选择的表单元素的值。所有其他元素都已打印,但 select 选定列表元素显示 undefined。这是我的代码category.services.
我正在尝试验证使用指令生成的动态表单输入并隔离范围。在指令之外,我有主窗体,在 ng-repeat 内部,我尝试使用 ng-form,但它从未显示错误消息。最初我在 ng-repeat 上有 ng-f
目标是当用户单击按钮转到下一页时,如果页面部分填写但无效,则阻止用户继续并显示错误指示符。 在模板驱动的表单中,我有几个容器元素使用 NgModelGroup 属性来表示表单中的“页面”。在我的组件中
我正在尝试做一个登录表单组件,但我无法读取表单数据。 当我尝试在控制台上写入用户名时,'undefined' 写入。 一切看起来都很正常,但表单数据没有到达组件。 下面是html代码:
这是父 HTML 这是子 HTML 我需要访问父组件中的子窗体状态 最佳答案 子模板: 子组件: export class Ch
login 工作组件的html代码是这样的。 Regis
我想知道是否有任何方法可以检索从表单的 NgForm.controls 对象中提取的 FormControl 的 NgModel它属于哪个,或者直接从表单中检索 NgModel。 我有一个表单,在提交
如何在组件中引用“myform”?是否可以?一定要使用 formbuilder(我尽量避免使用它)吗? Value 最佳答案 实际上还有另一种方法可以做到这一点。您可以使用
这个问题在这里已经有了答案: Angular 4.4.0-4.4.2 production build throwing "No provider for NgForm!" error (2 个答案
我在 Angular 4 上处理表单,我不知道使用 NgForm 和 FormGroup 处理错误和输入验证器有什么区别。处理表格有什么大的不同吗? 最佳答案 如果我没看错,您就会遇到模板驱动表单和响
我已经包含了 FormsModule 但它显示错误。 There is no directive with “exportAs” set to “ngForm” 我的 Login.component.
Angular 6 表单验证简单示例。通过电子邮件验证和选择框(下拉)。ngForm 带有选择框的 Angular 6 简单示例 最佳答案 使用ngForm。将其导入您的 component.modu
我是一名优秀的程序员,十分优秀!