我有角度的angular2-query-builder有问题。
这是我的querybuilder.components.ts文件
import { Component, OnInit } from '@angular/core';
import { QueryBuilderConfig } from "angular2-query-builder";
import { QueryBuilderModule } from "angular2-query-builder";
import { AuthService } from '../../services/auth.service';
import { Router } from '@angular/router';
import { FlashMessagesService } from 'angular2-flash-messages';
@Component({
selector: 'query-builder',
templateUrl: './querybuilder.component.html',
styleUrls: ['./querybuilder.component.css']
})
export class QuerybuilderComponent implements OnInit {
user: any;
isDev: boolean;
authToken: any;
query = {
condition: 'and',
rules: [
{ field: 'age', operator: '<=', value: 'Bob' },
{ field: 'gender', operator: '>=', value: 'm' }
]
};
config: QueryBuilderConfig = {
fields: {
age: { name: 'Age', type: 'number' },
gender: {
name: 'Gender',
type: 'category',
options: [
{ name: 'Male', value: 'm' },
{ name: 'Female', value: 'f' }
]
}
}
}
constructor(
private authService: AuthService,
private router: Router,
private flashMessage: FlashMessagesService
) { }
ngOnInit() { }
}
这里是我的querybuilder.component.html
<query-builder [(ngModel)]="query" config="config"></query-builder>
如果我想尝试一下,我会得到 ZoneAwarePromise :
以下是原始错误消息:
RangeError: Maximum call stack size exceeded at callWithDebugContext
(http://localhost:8080/vendor.bundle.js:54717:13) at
Object.debugCreateComponentView [as createComponentView]
(http://localhost:8080/vendor.bundle.js:54054:12) at createViewNodes
(http://localhost:8080/vendor.bundle.js:53400:46) at callViewAction
(http://localhost:8080/vendor.bundle.js:53865:13) at execComponentViewsAction
(http://localhost:8080/vendor.bundle.js:53774:13) at createViewNodes
(http://localhost:8080/vendor.bundle.js:53463:5) at callViewAction
(http://localhost:8080/vendor.bundle.js:53865:13) at execComponentViewsAction
(http://localhost:8080/vendor.bundle.js:53774:13) at createViewNodes
(http://localhost:8080/vendor.bundle.js:53463:5) at callViewAction
(http://localhost:8080/vendor.bundle.js:53865:13) at execComponentViewsAction
(http://localhost:8080/vendor.bundle.js:53774:13) at createViewNodes
(http://localhost:8080/vendor.bundle.js:53463:5) at callViewAction
(http://localhost:8080/vendor.bundle.js:53865:13) at execComponentViewsAction
(http://localhost:8080/vendor.bundle.js:53774:13) at createViewNodes
(http://localhost:8080/vendor.bundle.js:53463:5)
我做错了什么? 谢谢你,周末愉快。
答案 0 :(得分:0)
我找到了解决方案。 我没有在index.html和app.module.ts部分添加js-imports。