是否可以在WebStorm的自动导入功能中在导入和大括号之间添加空格?
目前自动导入的方式如下:
import {AbstractControl} from '@angular/forms';
Run Code Online (Sandbox Code Playgroud)
我想将其更改为:
import { AbstractControl } from '@angular/forms';
Run Code Online (Sandbox Code Playgroud) firebase中是否有方法可以检查DB中是否存在值?Firebase有方法.exists(),但根据文档,它只检查键.
我有以下结构:
{
"users": {
"-KKUmYgLYREWCnWeHCvO": {
"fName": "Peter",
"ID": "U1EL9SSUQ",
"username": "peter01"
},
"-KKUmYgLYREWCnWeHCvO": {
"fName": "John",
"ID": "U1EL5623",
"username": "john.doe"
}
}
}
Run Code Online (Sandbox Code Playgroud)
我想检查是否U1EL5623存在具有值的ID .
VS Code是文件路径的自动完成功能吗?例如,如果我想写js的完整路径:"assets/libs/jquery.min.js"
像Brackets.ie这样的编辑器默认情况下这样做.
我想获得哪个标签处于活动状态.我尝试使用@ViewChild装饰器并以这种方式访问元素属性,但它返回null.
零件:
import {Component, OnInit, ViewChild} from '@angular/core';
@Component({
selector: 'material-app',
template: `
<md-tab-group #tabGroup>
<md-tab label="Tab 1">Content 1</md-tab>
<md-tab label="Tab 2">Content 2</md-tab>
</md-tab-group>
`
})
export class AppComponent implements OnInit {
@ViewChild('tabGroup') tabGroup;
constructor() {
}
ngOnInit() {
console.log(this.tabGroup); // MdTabGroup Object
console.log(this.tabGroup.selectedIndex); // null
}
}
Run Code Online (Sandbox Code Playgroud)
我有一个自定义按钮小部件:
class Button extends StatelessWidget {
final String text;
Button(this.text);
@override
Widget build(BuildContext context) {
return Container(
height: 50,
child: SizedBox(
width: double.infinity,
child: RaisedButton(
onPressed: () => {}, // Use the function from parent Widget
child: Padding(
padding: EdgeInsets.symmetric(vertical: 13),
child: Text(
text,
style: TextStyle(fontWeight: FontWeight.bold),
)),
color: COLOR_BLUE,
textColor: Colors.white,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)),
),
),
);
}
}
Run Code Online (Sandbox Code Playgroud)
然后在父小部件中,我想将一个onPressed方法传递给这个按钮小部件:
...
myMethod () => {
// do some stuff
}
...
Padding(
padding: EdgeInsets.only(bottom: 10),
child: Button("Log …Run Code Online (Sandbox Code Playgroud) 我曾经用命令构建我的角度5项目:
ng build --prod --locale=de --base-href /onlineshopNP/de/ -op dist/de
Run Code Online (Sandbox Code Playgroud)
我已将我的项目更新为angular 6,当我调用该命令时,我收到如下错误:
模式验证失败,出现以下错误:数据路径""不应具有其他属性(o).错误:架构验证失败,并出现以下错误:数据路径""不应具有其他属性(o).在MergeMapSubscriber.registry.compile.pipe.operators_1.concatMap.validatorResult [作为项目](C:\ Users\martin.kuenz\Documents\Angular\webshop \node_modules\@ angular-devkit\architect\src\architect.js:218 :39)在MergeMapSubscriber._next的MergeMapSubscriber._tryNext(C:\ Users\martin.kuenz\Documents\Angular\webshop \node_modules\@ angular-devkit\_comchitect + node_modules\rxjs\operators\mergeMap.js:122:27) MergeMapSubscriber.Subscriber.next(C:\ Users)中的(C:\ Users\martin.kuenz\Documents\Angular\webshop \node_modules\@ angular-devkit\_comchitect + node_modules\rxjs\operators\mergeMap.js:112:18)\martin.kuenz\Documents\Angular\webshop \node_modules\@ angular-devkit\architect \node_modules\rxjs\Subscriber.js:90:18)at MergeMapSubscriber.notifyNext(C:\ Users\martin.kuenz\Documents\Angular \在InnerSubscriber._next(C:\ Users\martin.kuenz\Documents\Angular\webshop \node_modules\@ angular-)的webshop \node_modules\@ angular-devkit\_comchitect + node_modules\rxjs\operators\mergeMap.js:145:30)的devkit \建筑\node_modules\r xjs\InnerSubscriber.js:23:21)在InnerSubscriber.Subscriber.next(C:\ Users\martin.kuenz\Documents\Angular\webshop \node_modules\@ angular-devkit\_comchitect + node_modules\rxjs\Subscriber.js:90 :18)在SafeSubscriber.next(C)的SafeSubscriber .__ tryOrSetError(C:\ Users\martin.kuenz\Documents\Angular\webshop \node_modules\@ angular-devkit\core \node_modules\rxjs\Subscriber.js:248:16) :\ Users\martin.kuenz\Documents\Angular\webshop \node_modules\@ angular-devkit\core \node_modules\rxjs\Subscriber.js:188:27)at MapSubscriber._next(C:\ Users\martin.kuenz\Documents \角\网店\node_modules\@角的devkit \芯\node_modules\rxjs \运营\ map.js:85:26)
有谁能够帮我?
谢谢
Emmet是否有添加URL到<a href="">标记的语法?
例如:
句法:
a:www.google.com
Run Code Online (Sandbox Code Playgroud)
结果:
<a href="www.google.com"></a>
Run Code Online (Sandbox Code Playgroud) 我有一个SingleChildScrollView,里面有一个Container。我想要实现的是Container's高度应该是完整的视口高度。
我的代码:
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'MyApp',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
fontFamily: 'OpenSans',
),
home: SingleChildScrollView(
child: Container(
color: Colors.white,
height: double.infinity,
),
),
);
}
}
Run Code Online (Sandbox Code Playgroud)
如果我运行我的代码,我有一个例外:
I/flutter ( 6293): ??? EXCEPTION CAUGHT BY RENDERING LIBRARY ??????????????????????????????????????????????????????????
I/flutter ( 6293): The following assertion was thrown during performLayout():
I/flutter ( 6293): BoxConstraints forces an infinite height.
I/flutter ( 6293): These invalid constraints were …Run Code Online (Sandbox Code Playgroud) 我已经尝试过这个SO,但这不是我的情况。
我有一个服务 ( AnimationService),它依赖于另一个服务 ( AnimationStateService)。它AnimationStateService有一个 getter state,我想在测试中模拟它。所以我的测试看起来像这样:
动画.服务.规格.ts
describe("AnimationService", () => {
let animationService: SpyObj<AnimationService>;
let animationStateService: SpyObj<AnimationStateService>;
beforeEach(() => {
const spyAnimationStateService = createSpyObj("AnimationStateService", ["changeStatus"]);
TestBed.configureTestingModule({
providers: [
AnimationService,
{provide: AnimationStateService, useValue: spyAnimationStateService}
]
});
animationStateService = TestBed.get(AnimationStateService);
animationService = TestBed.get(AnimationService);
});
fit("should call changeStatus if status is AnimationStatus.Stopped", () => {
// Arrange
// animationStateService.status.and.returnValue(AnimationStatus.Stopped); - Doesn't work
// spyOnProperty(animationStateService, "status").and.returnValue(AnimationStatus.Stopped); - Doesn't work
// animationStateService.status = AnimationStatus.Stopped; - Works, …Run Code Online (Sandbox Code Playgroud) 我Deprecated symbol used ...在IDE中收到一条警告,要求delayWhen在我的应用程序中使用它。
我的代码:
private nextImg(): Observable<void> {
return this.stream$.pipe(
delayWhen(() => timer(1000),
tap(() => this.subject.next(NEXT_IMG)),
);
}
Run Code Online (Sandbox Code Playgroud)
angular ×3
flutter ×2
angular-cli ×1
angular6 ×1
dart ×1
deprecated ×1
emmet ×1
firebase ×1
html ×1
jasmine ×1
javascript ×1
mocking ×1
rxjs ×1
typescript ×1
unit-testing ×1
webstorm ×1