我正在使用@ViewChild是Angular.
在我的app.component.html上,我有:
<div #somename>Mark<span class="somethingelse">Hello something else</span></div>
Run Code Online (Sandbox Code Playgroud)
在我的app.component.ts上
@ViewChild('somename') SomeName;
constructor() {}
getInputValue() {
alert(this.SomeName.nativeElement('span').getElementByClassName('somethingelse').innerHTML);
}
Run Code Online (Sandbox Code Playgroud)
这不会返回任何东西.
我的问题是如何定位跨度的类并获得它的价值?
C:\dev\myApp> ng serve -o
Your global Angular CLI version (6.0.8) is greater than your local version (1.0.2).
The local Angular CLI version is used.
To disable this warning use `"ng config -g cli.warnings.versionMismatch false"`
Run Code Online (Sandbox Code Playgroud)
我不知道该怎么办。
我尝试卸载angular / cli和npm cache clean, 但是仍然有问题。
有人帮我!
我在'Angular6'中使用了连接sqlserver.
server.js
var express = require('express');
var app = express();
app.get('/', function (req, res) {
var sql = require("mssql");
// config for your database
var config = {
user: 'abc',
password: 'abc',
server: 'servername',
database: 'xyz'
};
// connect to your database
sql.connect(config, function (err) {
if (err) console.log(err);
// create Request object
var request = new sql.Request();
// query to the database and get the records
request.query('select * from tbl', function (err, recordset) {
if (err) console.log(err) …Run Code Online (Sandbox Code Playgroud) 我想在我的角度项目中导入cytoscape.js库,但是我不知道该怎么做。据我所知,目前还没有官方的角度cytoscape模块,有什么方法可以手动导入cytoscape吗?
当我试图用exceljs在Angular-6像这样
import * as excel from 'exceljs'
createExcel() {
let workbook = new excel.Workbook()
}
Run Code Online (Sandbox Code Playgroud)
即使我只是初始化一个类并得到此错误.如果我注释掉这一行,let workbook = new excel.Workbook()那么错误就消失了
./node_modules/fs-constants/browser.js找不到模块:错误:无法解析'D:\ Developer\spire-client \node_modules\fs-constants'中的'常量'
我正在尝试对API进行POST调用,并在标题中收到错误.我检查了所有其他相关问题,并确保它不是那些问题.我已经导入了rxjs map运算符.事实上,我在我的前端Angular 6应用程序中的数百个其他http调用中使用了完全相同的语法而没有任何问题.
以下是导致问题的代码段:
public createMap(map) {
map.companyId = this.company.getCompanyId();
const temp = this.json.clone(map);
temp.settings = this.json.manageJSON(temp.settings, true);
return this.authHttp.post(environment.coreApiPath + 'importMaps', temp)
.pipe(map((res: any) => {
map.ID = res.ID;
map.tempName = null;
this.maps.push(map);
return map;
}),
catchError(error => { throw Error('Custom Error: There was an error when attempting to create this import map.') }));
}
Run Code Online (Sandbox Code Playgroud)
错误在读取的行上 .pipe(map((res: any) => {
知道可能导致这个问题的原因是什么吗?
这是我的进口,以防万一你想知道:
import { HttpClient } from '@angular/common/http';
import { map, catchError } from 'rxjs/operators';
Run Code Online (Sandbox Code Playgroud) 我们有6个内容div。而且我们在每个div处使用字符限制。我们使用了bootstrap 4 angular 6版本。
6 div打开或关闭某些div切换内容 如何实现这种情况。
将下载的JSON文件作为结构.希望能够通过Angular中的文件上传(使用Angular 6)上传它,然后直接在Angular中读取文件的内容,而不是将其上传到API.
搜索类似的接缝以恢复如何在Angular中读取服务器上的本地文件,而不是通过文件上载.
我正在angular6项目中实施amcharts4 “ Animated-Gauge”演示。
这是我的代码:
在StackBlitz在线编辑器上运行良好,但是在我的angular6项目中实现时抛出错误。它在第25行抛出了错误警告,这是
var axis = chart.xAxes.push(new am4charts.ValueAxis());
Run Code Online (Sandbox Code Playgroud)
当我将鼠标悬停在第25行错误时,就会抛出此错误。
Argument of type 'ValueAxis<AxisRenderer> is not assignable to parameter'
of type Axis<AxisRendererCircular>
Run Code Online (Sandbox Code Playgroud)
这是我的错误图片:
我该如何解决这个问题?
angular6 ×10
angular ×5
typescript ×4
javascript ×3
amcharts ×1
angular-cli ×1
bootstrap-4 ×1
charts ×1
cytoscape.js ×1
exceljs ×1
http ×1
node.js ×1
sql-server ×1