无法阅读属性' mobileStepText' of undefined - ngxstepper

时间:2018-05-09 09:01:27

标签: angular angular-material

我收到错误

  

无法阅读属性' mobileStepText'在尝试使用ngx-stepper时未定义。

以下是我的代码:
它是来自此网站的直接样本:Angular Steppers directive for Angular Material

但它没有用。

String str = "myfile.txt"

doit(str as File)
doit(str.asType(File))
doit(new File(str))

.TS

<ngx-stepper #stepperDemo="stepper" [options]="options">
    <ngx-step [label]="'Select a campaign'">
      <ngx-step-body>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur </p>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur nobis</p>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur nobis saepe </p>
        <p>Lorem ipsumsamus repellendus deserunt. Odio sit similique, labore </p>
      </ngx-step-body>
      <ngx-step-actions>
        <button md-button class="md-primary md-raised" (click)="selectCampaign()">Continue</button>
        <button md-button class="md-primary" (click)="stepper.back()">Cancel</button>
      </ngx-step-actions>
    </ngx-step>
    <ngx-step [label]="'Publish the ad'">
      <ngx-step-body>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur nobis saepe facere suscipit atque,
          sapiente, natus mollitia ipsum odit accusamus repellendus deserunt. Odio sit similique, labore maxime
          voluptatibus, eaque autem!</p>
      </ngx-step-body>
      <ngx-step-actions>
        <button md-button class="md-primary md-raised" (click)="stepper.next()">Complete</button>
        <button md-button class="md-primary" (click)="stepper.back()">Back</button>
      </ngx-step-actions>
    </ngx-step></ngx-stepper>

我该怎么办?

1 个答案:

答案 0 :(得分:0)

您应该在RegistrationComponent类

中定义选项

options: StepperOptions = {
    linear: false,
    mobileStepText: false,
    alternative: true,
    vertical: false
  };