在我的 Angular 单元测试中,尽管我已经导入了DatepickerModule.forRoot(),但我得到:
Error: Template parse errors:
Can't bind to 'bsConfig' since it isn't a known property of 'input'. ("
class="form-control datepicker datetime-picker"
bsDatepicker
[ERROR ->][bsConfig]="myConfig"
[(ngModel)]="myDate"
>
"): ng:///DynamicTestModule/DatetimePickerComponent.html@6:6
at syntaxError node_modules/@angular/compiler/esm5/compiler.js:486:22)
at TemplateParser.webpackJsonp../node_modules/@angular/compiler/esm5/compiler.js.TemplateParser.parse node_modules/@angular/compiler/esm5/compiler.js:24674:1)
at JitCompiler.webpackJsonp../node_modules/@angular/compiler/esm5/compiler.js.JitCompiler._parseTemplate node_modules/@angular/compiler/esm5/compiler.js:34629:1)
at JitCompiler.webpackJsonp../node_modules/@angular/compiler/esm5/compiler.js.JitCompiler._compileTemplate node_modules/@angular/compiler/esm5/compiler.js:34604:1)
at http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/compiler/esm5/compiler.js:34505:48
at Set.forEach (<anonymous>)
at JitCompiler.webpackJsonp../node_modules/@angular/compiler/esm5/compiler.js.JitCompiler._compileComponents node_modules/@angular/compiler/esm5/compiler.js:34505:1)
at http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/compiler/esm5/compiler.js:34393:1
at Object.then node_modules/@angular/compiler/esm5/compiler.js:475:33)
at JitCompiler.webpackJsonp../node_modules/@angular/compiler/esm5/compiler.js.JitCompiler._compileModuleAndAllComponents node_modules/@angular/compiler/esm5/compiler.js:34391:1)
Expected undefined to be truthy.
at UserContext.<anonymous> src/app/components/my-spec.spec.ts:41:23)
at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke node_modules/zone.js/dist/zone.js:388:1)
at ProxyZoneSpec.webpackJsonp../node_modules/zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke node_modules/zone.js/dist/proxy.js:128:1)
Run Code Online (Sandbox Code Playgroud) 我的 utils 服务使用 express 框架从 mysql 数据库返回数据
import { Injectable } from '@angular/core';
import { Http, HttpModule, Headers, RequestOptions } from '@angular/http';
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
@Injectable()
export class UtilsService implements OnInit{
public authData : any[];
constructor(private http : Http) {
}
ngOnInit() { }
getUserData() {
const reqData = JSON.parse(localStorage.getItem('AuthUser'));
return this.http.post('/get/logindata',reqData)
.map(result => result.json().data);
}
}
Run Code Online (Sandbox Code Playgroud)
我的组件部分
import { Component, OnInit } from '@angular/core';
import { UtilsService …Run Code Online (Sandbox Code Playgroud) 我正在尝试使表面哑光,但没有成功。应用于它的StandardMaterial只有一个diffuseColor。我尝试使用“粗糙度”(0 到 7 之间),但表面总是有光泽的。
如何获得哑光表面?
我想将 div 放在组件内居中,而不影响该组件内 div 的样式。我怎么能这样做呢?
我正在使用角度 8 。文本对齐方法会影响该 div 内文本的对齐方式。我想将元素居中,同时防止这种情况发生。
确保在 Angular8 文本框中输入的任何输入均为大写的正确方法是什么?
我尝试将样式应用于输入标签
文本转换:大写
,但看起来虽然输入框中输入的文本外观是大写的,但实际存储在
[(ng模型)]
不以大写形式显示为大写。
angular ×4
javascript ×2
typescript ×2
angular5 ×1
babylonjs ×1
css ×1
datepicker ×1
frontend ×1