进度条不适用于Ionic 3

时间:2017-12-17 06:00:39

标签: angular ionic3

我尝试在This Reference Link 之后在Ionic 3应用程序中实现进度条,但是出现以下错误。

Runtime Error:Template parse errors: Can't bind to 'progress' since it isn't a known property of 'progress-bar'.1. If 'progress-bar' is an Angular component and it has 'progress' input, then verify that it is part of this module. 2. If 'progress-bar' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. 3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("u, including the respective address and opening hours</p> </span><br> <progress-bar [ERROR ->][progress]=50></progress-bar> </ion-card-content> "): ng:///AppModule/HomePage.html@21:22 'progress-bar' is not a known element: 1. If 'progress-bar' is an Angular component, then verify that it is part of this module. 2. If 'progress-bar' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("trooms near you, including the respective address and opening hours</p> </span><br> [ERROR ->]<progress-bar [progress]=50></progress-bar> </ion-card-content> "): ng:///AppModule/HomePage.html@21:8

我已经创建了一个名为ProgressBarComponent的组件,如教程中所示,ts文件的代码是

import { Component, Input } from '@angular/core';

@Component({
  selector: 'progress-bar',
  templateUrl: 'progress-bar.html'
})
export class ProgressBarComponent {

  @Input('progress') progress;

  constructor() {

  }

}

我无法弄清楚错误,因为相同的代码似乎对其他人有效,但不是我。

1 个答案:

答案 0 :(得分:1)

在模块声明中添加 ProgressBarComponent

@NgModule({
    imports: [

    ],
    declarations: [
      ProgressBarComponent
   ]
})