我知道不是第一个问这个问题,正如我在标题中提到的,我正在尝试转换字符串值布尔值.
我之前已经将一些值放入本地存储中,现在我想获取所有值并将所有值分配给一些布尔变量.
app.component.ts
localStorage.setItem('CheckOutPageReload', this.btnLoginNumOne + ',' + this.btnLoginEdit);
Run Code Online (Sandbox Code Playgroud)
这里this.btnLoginNumOne 和this.btnLoginEdit是字符串值("真,假") .
mirror.component.ts
if (localStorage.getItem('CheckOutPageReload')) {
let stringToSplit = localStorage.getItem('CheckOutPageReload');
this.pageLoadParams = stringToSplit.split(',');
this.btnLoginNumOne = this.pageLoadParams[0]; //here I got the error as boolean value is not assignable to string
this.btnLoginEdit = this.pageLoadParams[1]; //here I got the error as boolean value is not assignable to string
}
Run Code Online (Sandbox Code Playgroud)
在这个组件中,this.btnLoginNumOne和this.btnLoginEdit是布尔值;
我尝试了stackoverflow中的解决方案,但没有任何工作.
任何人都可以帮我解决这个问题.
我是Angular 6的新手,在我的项目中我得到了以下错误
ERROR in multi ./node_modules/bootstrap/dist/css/bootstrap.min.css ./styles.css
Module not found: Error: Can't resolve 'C:\Users\User\e-CommerceWebsite\styles.css' in 'C:\Users\User\e-CommerceWebsite'
Run Code Online (Sandbox Code Playgroud)
和浏览器显示
cannot Get
Run Code Online (Sandbox Code Playgroud)
angular.json
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
],
"scripts": [
"./node_modules/jquery/dist/jquery.min.js",
"./node_modules/popper.js/dist/popper.min.js",
"./node_modules/bootstrap/dist/js/bootstrap.min.js"
]
Run Code Online (Sandbox Code Playgroud)
styles.css的
@import '~bootstrap/dist/css/bootstrap.min.css';
...
...
...
Run Code Online (Sandbox Code Playgroud)
提到这个:bootstrap没有连接角6?
任何人都可以帮我修复此错误.
我是angular的新手,在我的应用程序中有一个Mat-dialog,其中有两种形式,即Login和SignUp。
第一次打开对话框时,自动焦点设置在用户名字段上。问题是当我单击按钮导航到SignUp表单时,该表单的FIRST名字段没有自动聚焦,现在从注册导航到登录用户名字段的方法相同不能自动聚焦。
我已经尝试了一些stackoverflow解决方案,但没有任何解决方案解决我的问题。
popupScreen.component.html
<form class="login" *ngIf="isLoginHide">
<mat-form-field>
<input matInput placeholder="username">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="password">
</mat-form-field>
<button mat-button color="primary">Login</button>
<button mat-button (click)="hideLogin($event)" color="accent">SignUp</button>
</form>
<form class="SignUp" *ngIf="isSignUpHide">
<mat-form-field>
<input matInput placeholder="First Name">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Last Name">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="username">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="password">
</mat-form-field>
<button mat-button (click)="hideSignUp($event)" color="primary">Login</button>
<button mat-button color="accent">SignUp</button>
</form>
Run Code Online (Sandbox Code Playgroud)
谁能帮我解决这个问题。
我是 angular 6 的新手,在这里我需要比较日期输入并找到最大的输入。
input 1 : 2018-12-29T00:00:00
input 2 : Mon Dec 31 2018 00:00:00 GMT+0530 (India Standard Time)
Run Code Online (Sandbox Code Playgroud)
在这里,我收到了来自 mssql 数据库的输入 1和来自材料 datepicker的输入 2。
如下比较这两个日期时,我得到了错误。
console.log(mMagazineObject.From < mMagazineObject.To ? true : false);
Run Code Online (Sandbox Code Playgroud)
有没有可能比较这两种日期格式。如果是,请帮我解决这个问题。
我对angular并不陌生,并且正在为UI使用Angular Material Design。
在我的应用程序中,我有一个小吃店。
现在我想在快餐栏上设置一个图标,但是我尝试了一些我无法设置的Stackoverflow帖子。
码:
this.snackBar.open('You are already registered.Please log in.','', { duration: 2000 });
Run Code Online (Sandbox Code Playgroud)
我想将图标设置为图片中的图标,但是下面有没有图标的小吃店。我不知道如何添加它。
谁能帮我添加一下。
我对 Angular 5 完全陌生,我想在应用程序打开时显示登录页面。
现在我显示 appComponent,它有工具栏和侧面导航栏。但是当用户加载应用程序时,如果登录成功,我想显示登录屏幕,那么只有用户应该允许查看主页。
如果我将我的应用程序组件作为登录组件,我无法根据用户的菜单选择在主页中加载不同的组件。
应用程序组件.html
<mat-sidenav-container fullscreen>
<mat-sidenav #sidenav class="app-sidenav">
<mat-nav-list>
<a mat-list-item routerLink="/home" routerLinkActive="active-list-item">
<h2 matLine>Home</h2>
<mat-icon matListIcon>home</mat-icon>
</a>
<a mat-list-item routerLink="/account" routerLinkActive="active-list-item">
<h2 matLine>Account</h2>
<mat-icon matListIcon>person</mat-icon>
</a>
<a mat-list-item routerLink="/settings" routerLinkActive="active-list-item">
<h2 matLine>Settings</h2>
<mat-icon matListIcon>settings</mat-icon>
</a>
</mat-nav-list>
</mat-sidenav>
<mat-sidenav-content>
<mat-toolbar color="primary" class="mat-elevation-z3">
<button mat-icon-button (click)="sidenav.toggle()">
<mat-icon>menu</mat-icon>
</button>
My App
</mat-toolbar>
<div class="app-content">
<router-outlet></router-outlet> // router-outlet
</div>
</mat-sidenav-content>
</mat-sidenav-container>
Run Code Online (Sandbox Code Playgroud)
目前,当我运行应用程序时,正在加载此页面。我想显示全屏登录页面,而不是首先显示主页。
const routings: Routes = [
{path:'',redirectTo:'/app-root',pathMatch:'full'},
{path:'home',component:HomeComponent},
{path:'account',component:AccountComponent},
{path:'settings',component:SettingsComponent},
{path:'**',redirectTo:'/app-root',pathMatch:'full'},
];
Run Code Online (Sandbox Code Playgroud)
目前,当 url 为 ' ' …
我是angular 6的新手,在这里我尝试在提交数据后重置表单。
一切正常,但是当成功将数据提交到数据库后重置表单时,它将触发表单中所有必需的验证器。
我尝试了很多方法解决这个问题,但是我无法解决。
在这里,在每次提交表单之后,我都想重置表单和所有验证器,然后再在表单字段中输入数据以进行另一次提交。
app.component.html
<form [formGroup]="newMemberForm" (submit)="CreateMember(newMemberForm.value)" novalidate>
....
....
</form>
Run Code Online (Sandbox Code Playgroud)
app.component.ts
this.newMemberForm = this.formBuilder.group({
M_Number: ['', [Validators.required]],
F_Number: ['', [Validators.required]],
M_Name: ['', [Validators.required, Validators.minLength(4)]],
M_Status: ['', [Validators.required]],
M_Dob: ['', [Validators.required]],
M_Sex: ['', [Validators.required]],
});
CreateMember(memberForm) {
this.dmlService.CreateNewMember(memberForm).subscribe(data => {
if (data[0]['RESPONSE'] == 'TRUE')
{
this.newMemberForm.reset();
}
});
}
Run Code Online (Sandbox Code Playgroud)
在这里我重置了触发所需验证器的表单。如果我清除了上述函数中的所有验证器,则当我输入其他表单数据时,验证将无法进行。
在这里,我想在每次提交表单后重设所有验证器和表单,并且想提交下一组表单数据。
谁能帮我解决这个问题。
我是 Angular 6 的新手,这里我有 formControl,而不是根据业务需求使用 FormGroup。
应用程序组件.html
<button
class="col-sm-12"
[disabled]="comittee_Member_Name.invalid && comittee_Member_Number.invalid && comittee_Type.invalid && comittee_Member_Position.invalid && comittee_Member_Status.invalid"
>
Save
</button>
Run Code Online (Sandbox Code Playgroud)
在这里,如果formControl 中的任何一个无效,我想禁用该按钮。但就我而言,它仅验证第一个表单控件(comittee_Member_Name)。
应用程序组件.ts
comittee_Member_Name =new FormControl();
comittee_Member_Number = new FormControl();
comittee_Type = new FormControl();
comittee_Member_Position = new FormControl();
comittee_Member_Status = new FormControl();
Run Code Online (Sandbox Code Playgroud)
谁能帮我解决这个问题。
我在一个 angular 5 应用程序中工作,在这个用于登录的应用程序中,我有一个 Angular Material Design 弹出窗口。
我在对话框屏幕中有以下过程。
检查用户邮件是否启用了新的注册表单或启用了密码字段。
所以最初我将电子邮件输入的对话框高度和宽度设为100 * 100
如果用户不存在,将启用注册表单,我想将高度和宽度设置为300*100
如果用户已经存在,那么密码字段将与电子邮件输入一起启用,我想设置200 * 100
我是新手,所以我找不到也在 SO can't solve it 上搜索的解决方案。
myAccountClick(event) {
const dialogScreen = this.dialog.open(MyaccountComponent,{height:'100px',width:'100px'});
}
Run Code Online (Sandbox Code Playgroud)
谁能帮我解决这个问题。
我是 SQL Server 新手,我正在尝试将 6 位字符串值插入到NVARCHAR列中。但它会完美地存储数据,直到 6 位数字字符串以0开头。
Ex: 001212 -->stores as 1212
121212 -->stores as 121212
012121 -->stores as 12121
120121 -->stores as 120121
Run Code Online (Sandbox Code Playgroud)
我在 stackoverflow 上搜索了解决方案,但我可以找到此问题的解决方案。
但我有一个想法,如果字符串长度不是 6 位,则验证字符串长度,然后添加0。
如果它是正确的,有人可以帮助我做到这一点。