我正在使用Angular 4和Angular Material 2.对于以下代码:
<form>
<md-form-field>
<input mdInput [ngModel]="userName" placeholder="User" [formControl]="usernameFormControl">
<md-error *ngIf="usernameFormControl.hasError('required')">
This is <strong>required</strong>
</md-error>
<input mdInput [ngModel]="password" placeholder="Password" [formControl]="passwordFormControl">
<md-error *ngIf="passwordFormControl.hasError('required')">
This is <strong>required</strong>
</md-error>
<button md-raised-button color="primary" [disabled]="!usernameFormControl.valid || !passwordFormControl.valid">Login</button>
</md-form-field>
</form>
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
模板解析错误:'md-form-field'不是已知元素:1.如果'md-form-field'是Angular组件,则验证它是否是此模块的一部分.2.如果'md-form-field'是Web组件,则将'CUSTOM_ELEMENTS_SCHEMA'添加到此组件的'@NgModule.schemas'以禁止显示此消息.("[错误 - >]
你能不能帮我解决我失踪的地方?
以下是我app.module.ts
导入材料模块的代码:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { LoginComponent …
Run Code Online (Sandbox Code Playgroud) 如何将逗号分隔的字符串转换为数组?
我有输入' 1,2,3'
,我需要将其转换为数组.
有没有办法在javascript中创建像java这样的Set数据结构(Unique Collections)?
我有这个代码:
String s = "A very long string containing " +
"many many words and characters. " +
"Newlines will be entered at spaces.";
StringBuilder sb = new StringBuilder(s);
int i = 0;
while ((i = sb.indexOf(" ", i + 20)) != -1) {
sb.replace(i, i + 1, "\n");
}
System.out.println(sb.toString());
Run Code Online (Sandbox Code Playgroud)
代码的输出是:
A very long string containing
many many words and
characters. Newlines
will be entered at spaces.
Run Code Online (Sandbox Code Playgroud)
上面的代码将字符串包装在每30个字符的下一个空格之后,但我需要将字符串包装在每30个字符的前一个空格之后,就像它的第一行一样:
A very long string
第二行将是
containing many
Run Code Online (Sandbox Code Playgroud)
请给出一些适当的解决方案
我目前的网址是:
https://localhost:8080/MyApp/manager/dashboard
在上面的 url 中,我只想获取https://localhost:8080/MyApp/部分。
有没有办法在没有硬编码的情况下获取它?
我使用以下网址从雅虎财经获取历史数据.自2017年5月16日起,网址无效.
好像他们已经更改了网址,新的网址是:
在上面更改的URL中有一个会话cookie,它是crumb.有没有想过如何以编程方式获取此cookie(在JAVA中)?
需要一个正则表达式来使用逗号分隔符验证数字. 1,5,10,55有效,但1 ,,,, 10无效.
版本
Angular CLI: 6.0.0
Node: 8.11.1
OS: win32 x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.0
@angular-devkit/build-angular 0.6.0
@angular-devkit/build-optimizer 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.0
@angular/cdk 6.0.1
@angular/flex-layout 6.0.0-beta.15
@angular/material 6.0.1
@ngtools/webpack 6.0.0
@schematics/angular 0.6.0
@schematics/update 0.6.0
rxjs 6.1.0
typescript 2.7.2
webpack 4.6.0
Run Code Online (Sandbox Code Playgroud)
脚步
Install Angular v6 / CLI v6
ng build --configuration=stage --bh /XYZ/
Run Code Online (Sandbox Code Playgroud)
错误 未知选项:' - bh'
观察到的行为build -bh CLI选项在v6中不起作用(或者已被删除?),但文档尚未更新以反映使用'base-href'构建的新方法?
$ .removeCookie未删除Chrome中的Cookie.
请参阅以下屏幕截图附件.屏幕截图取自Chrome设置 - >所有Cookie和网站数据.
上面的屏幕截图清楚地显示了一个cookie(名称:!Proxy!proxyJSESSIONID和path:/ stockquote/rest/auth)可用.但当
$.removeCookie('!Proxy!proxyJSESSIONID', { path: '/stockquote/rest/auth'});
Run Code Online (Sandbox Code Playgroud)
代码被执行它返回错误和不删除的cookie.
我正在使用jQuery Cookie Plugin v1.4.1.
我有如下的路线配置:
const routes: Routes = [
{ path: '', redirectTo: '/login', pathMatch: 'full' },
{ path: 'login', component: LoginComponent },
{ path: 'dashboard', component: DashboardComponent }
];
Run Code Online (Sandbox Code Playgroud)
现在,如果有人想访问像http://localhost:4200/xyzxyz
这样的 url ,那么我会收到此错误
未捕获(承诺):错误:无法匹配任何路由。URL 段:'xyz'
但我想在上述情况下重定向到登录页面。
知道我怎样才能实现这一目标吗?
angular ×4
javascript ×3
jquery ×3
cookies ×2
angular-cli ×1
angular5 ×1
finance ×1
java ×1
oracle ×1
plsql ×1
regex ×1
tokenize ×1
typescript ×1
validation ×1
yahoo-api ×1