我正在开发一个角7应用程序,在这个应用程序中,我正在使用一个“提到”插件在一个内容可编辑的div。当有人从下拉列表中选择了一个值时,就会调用一个方法,而我可以得到所选的项,但问题是,我不能在将所选项发送到服务器的同一个类中调用另一个方法。我得到以下错误:
我使用的提到库是:
https://github.com/dmacfarlane/angular-mentions
这是我的错误
PageContentComponent.html:4 ERROR TypeError: this.createBlock is not a function
,这是我的类
import { Component,
当我改变注入参数的顺序时,程序仍然可以正常运行。为什么?这违反了JS的常识。
以下代码的效果是相同的。但是参数的顺序是不同的。
export class ProductDetailsComponent implements OnInit {
// CartService is a service generated through `ng generate service cart`
// ActivatedRoute form `import { ActivatedRoute } from '@angular/router'`
constructor
当试图设置属性的类型时,我会得到错误的Cannot find name 'Subscription'。从哪个包进口?
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
// I'm missing an import here. Just don't know which package to load from.
@Component({
Params在targetComponent中订阅:
import Router from @angular/Router
export class TargetComponent {
constructor(private activeRoute: ActivatedRoute) {
this.activeRoute.params.subscribe(params => {
console.log(params) // receives targetName but with different attributes
co