我在Angular中有以下HTML
public function validatePhoneNumber(Request $request)
{
try {
$this->validate($request, ['phone' => 'required|digits:11']);
} catch (ValidationException $e) {
return response()->json([
'code' => 406,
'message' => "forbidden",
'errors' => $e->getMessage(),
]);
}
return [
'code' => 200,
'message' => 'Phone number ok',
'data' => $request->phone
];
}
我想知道的是如何设置<span *ngIf="ControllerType?.AttributeID =='Controller Type'">
<select multiple name="ControllerType.Default" [(ngModel)]="ControllerType1">
<option *ngFor="let z of ControllerType.Options" value={{z.OptionID}}>
{{z.OptionID}}
</option>
</select>
</span>
字符串类型来获取ControllerType.Default
中选择的值。因此,选择并存储在ControllerType1
中的任何值也应存储在ControllerType1
在Select标记之后和迭代内部执行此ControllerType.Default
只会出错。
答案 0 :(得分:1)
使用body,
div,
a {
padding: 0;
margin: 0;
font-family: Oswald, Arial, Helvetica, sans-serif;
}
body {
background: url(http://i.imgur.com/9YZkD5U.jpg) no-repeat center center fixed;
background-size: cover;
}
#calculator {
opacity: 0.9;
background: rgba(200, 200, 200, 0.8);
width: 370px;
height: 465px;
margin: 10px auto;
padding: 20px 10px 10px 10px;
border-radius: 5px;
margin-top: 10%;
}
#calculator a {
display: block;
float: left;
cursor: pointer;
text-decoration: none;
text-align: center;
color: black;
border-radius: 5px;
}
#numbers,
#operators {
margin: auto;
}
#operators a {
width: 46px;
height: 45px;
font-size: 26px;
padding: 2px;
margin: 5px 5px;
color: #444;
background-color: #fff;
border-radius: 5px;
}
#numbers a {
width: 50px;
height: 50px;
font-size: 30px;
padding: 10px;
margin: 5px;
background-color: #fff;
color: #444;
border-radius: 5px;
}
#total {
height: 70px;
width: 290px;
margin: auto;
background-color: #81A4B8;
margin-bottom: 5px;
text-align: right;
font-size: 47px;
padding: 0px 5px;
color: #fff;
border-radius: 5px;
}
#side {
width: 49px;
float: right;
}
#side a {
width: 40px;
height: 40px;
float: right;
font-size: 25px;
padding: 10px;
margin: 5px;
background-color: #fff;
color: #444;
border-radius: 5px;
}
a#equals {
padding-top: 50px;
height: 100px;
background-color: #d88d61;
color: white;
border-radius: 5px;
}
#clear, #clearall {
background-color: #f27b7b !important;
color: #fff !important;
}
#extras {
float: left;
}
#extras a {
float: left;
width: 40px;
height: 40px;
font-size: 25px;
padding: 10px;
margin: 5px;
background-color: #fff;
color: #444;
border-radius: 5px;
}
ngModelChange
已更新
创建和<span *ngIf="ControllerType?.AttributeID =='Controller Type'">
<select multiple name="ControllerType.Default" [(ngModel)]="ControllerType1" (ngModelChange)="ControllerType.Default = ControllerType1">
<option *ngFor="let z of ControllerType.Options" value={{z.OptionID}}>
{{z.OptionID}}
</option>
</select>
</span>
指令并在HTML
ngInit
在ngInit指令下分配表达式
@Directive({
selector: 'ngInit',
exportAs: 'ngInit'
})
export class NgInit {
@Input() values: any = {};
@Input() ngInit;
ngOnInit() {
if(this.ngInit) { this.ngInit(); }
}
}
[ngInit]="ControllerType1 = ControllerType.Default"