Angular 扩展离子按钮

Angular 扩展离子按钮,angular,ionic2,ionic3,Angular,Ionic2,Ionic3,我想扩展ion按钮组件,在我自己的自定义组件上添加一些方法。所以我做了: import {Component, ElementRef, Renderer} from '@angular/core'; import {Button, Config} from "ionic-angular"; @Component({ selector: '[search-button]', templateUrl: 'search-button.component.html', }) export cl

我想扩展
ion按钮
组件,在我自己的自定义组件上添加一些方法。所以我做了:

import {Component, ElementRef, Renderer} from '@angular/core';
import {Button, Config} from "ionic-angular";

@Component({
  selector: '[search-button]',
  templateUrl: 'search-button.component.html',
})
export class SearchButtonComponent extends Button {
  constructor(ionButton: string, config: Config, elementRef: ElementRef, renderer: Renderer) {
    super(ionButton, config, elementRef, renderer);
  }
}
但这给了我一个
错误:Uncaught(承诺中):错误:字符串没有提供程序错误


扩展离子组件的好方法是什么?

我想您已经在app-module.ts中正确定义了SearchButtonComponent?导入它并在声明数组中定义它。或者在父组件的providers部分(如果嵌套和单例不会运行),如果有,我会查看原始组件的源代码。github.com/ionic-team/ionic/blob/master/src/components/butu‌​n/…在原始的@Component元数据中,它还具有更改检测和视图封装。您可能也需要复制它。这里还有一个讨论,不确定基类的@Input注释是否默认继承。。。下面是一个例子: