当我编译mi app时,我有这个错误,ERROR TypeError:jit_nodeValue_7(...)。$ any不是函数 我几乎尝试了所有可用的东西。但我无法找到任何解决方案,我已经重新安装了所有包装,并且没有更新任何内容
我的package.json是
"dependencies": {
"@agm/core": "^1.0.0-beta.0",
"@angular/animations": "^4.3.1",
"@angular/cdk": "^5.1.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.2.1",
"@angular/http": "^5.0.0",
"@angular/material": "^5.1.0",
"@angular/platform-browser": "^5.2.1",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/platform-server": "^5.0.0",
"@angular/router": "^5.0.0",
"angular-form-validator": "^1.6.2",
"angular-material-source": "github:angular/material",
"angular2-material-datepicker": "^0.5.0",
"animate.css": "^3.5.2",
"arrive": "^2.3.1",
"bootstrap": "^3.3.5",
"bootstrap-material-design": "^0.5.10",
"bootstrap-notify": "^3.1.3",
"bootstrap-select": "^1.12.2",
"bootstrap-tagsinput": "^0.7.1",
"chartist": "^0.9.4",
"chartist-plugin-zoom": "^0.4.0",
"core-js": "^2.4.1",
"datatables": "^1.10.12",
"datatables.net-bs": "^1.10.12",
"datatables.net-responsive": "^2.1.1",
"eonasdan-bootstrap-datetimepicker": "^4.17.47",
"fullcalendar": "^3.4.0",
"googleapis": "^19.0.0",
"hammerjs": "^2.0.8",
"jasny-bootstrap": "^3.1.3",
"jquery": "^1.12.4",
"jquery-validation": "^1.17.0",
"jvectormap": "^2.0.4",
"moment": "^2.18.1",
"ng2-nouislider": "^1.6.1",
"ng2-select": "^1.2.0",
"ngx-chips": "^1.4.6",
"nouislider": "^9.2.0",
"perfect-scrollbar": "^1.2.0",
"rxjs": "^5.5.2",
"sweetalert2": "^7.0.5",
"twitter-bootstrap-wizard": "^1.2.0",
"typescript": "^2.4.2",
"validate": "^3.0.1",
"web-animations-js": "^2.3.1",
"zone.js": "^0.8.4"
我的组件是
import { Component, OnInit, ElementRef } from '@angular/core';
import { userLogin } from 'app/entities';
import { UserService } from '../user.service';
declare var $: any;
@Component({
selector: 'app-login-cmp',
templateUrl: './login.component.html'
})
export class LoginComponent implements OnInit {
private toggleButton: any;
private sidebarVisible: boolean;
private nativeElement: Node;
constructor(private element: ElementRef, private userService: UserService, )
{
this.nativeElement = element.nativeElement;
this.sidebarVisible = false;
}
public user: userLogin;
ngOnInit() {
this.user = {username:'',downtown:'tunja',password:''};
this.userService.loginUser(this.user);
var navbar: HTMLElement = this.element.nativeElement;
this.toggleButton = navbar.getElementsByClassName('navbar-toggle')[0];
setTimeout(function () {
// after 1000 ms we add the class animated to the login/register card
$('.card').removeClass('card-hidden');
}, 700);
}
sidebarToggle() {
var toggleButton = this.toggleButton;
var body = document.getElementsByTagName('body')[0];
var sidebar = document.getElementsByClassName('navbar-collapse')[0];
if (this.sidebarVisible == false) {
setTimeout(function () {
toggleButton.classList.add('toggled');
}, 500);
body.classList.add('nav-open');
this.sidebarVisible = true;
} else {
this.toggleButton.classList.remove('toggled');
this.sidebarVisible = false;
body.classList.remove('nav-open');
}
}
//Funciones
onSubmit() {
this.userService.loginUser(this.user); }
}
我的html是
<div class="wrapper wrapper-full-page">
<div class="full-page login-page" filter-color="black">
<!-- you can change the color of the filter page using: data-color="blue | purple | green | orange | red | rose " -->
<br>
<br>
<br>
<br>
<br>
<div class="content">
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-6 col-md-offset-4 col-sm-offset-3">
<form method="#" action="#" #loginForm="ngForm" (ngSubmit)="onSubmit()">
<div class="card card-login card-hidden">
<div class="card-header text-center" data-background-color="rose">
<h4 class="card-title">Login</h4>
</div>
<div class="card-content">
<div class="input-group">
<span class="input-group-addon">
<i class="material-icons">email</i>
</span>
<div class="form-group label-floating">
<label class="control-label">Usuario</label>
<input type="text" class="form-control" required [(ngModel)]="user.username" name="username">
</div>
</div>
<div class="input-group">
<span class="input-group-addon">
<i class="material-icons">lock_outline</i>
</span>
<div class="form-group label-floating">
<label class="control-label">Password</label>
<input type="password" class="form-control" required [(ngModel)]="user.password" name="password">
</div>
</div>
</div>
<div class="footer text-center">
<button type="submit" class="btn btn-rose btn-simple btn-wd btn-lg">Iniciar sesion</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="copyright pull-right">
© {{test | date: 'yyyy'}}
<a href="https://www.Zuama.com">Zuama</a>
</p>
</div>
</footer>
<div class="full-page-background" style="background-image: url(../../../assets/img/login.jpeg) "></div>
</div>
答案 0 :(得分:0)
安装所有依赖项后,您使用的是什么版本的Angular?
每次我尝试在任何输入字段中输入内容时,在将Angular版本从5.0.3更新到5.2.1之后,我得到了相同的错误。经过一些研究,我意识到我没有更新@ angular / compiler版本。
修复版本后,错误消失了。因此,请确保您在所有Angular依赖项中都具有相同的版本。