Git Product home page Git Product logo

ionic-stepper's Introduction

ionic-stepper

Steppers components for Ionic.

Build Status Dependency Status NPM version Downloads MIT License

中文 README

Getting Started

Prerequisites

  • ionic-angular: ^3.x
  • @angular/animations: ^4.x

Installing

$ npm install ionic-stepper
# or
$ yarn add ionic-stepper

Usage

import in your-root.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';

...

import { IonicStepperModule } from 'ionic-stepper';

@NgModule({
  ...
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    IonicStepperModule,
    IonicModule.forRoot(MyApp)
  ],
  ...
})
export class AppModule {}

your-component.ts

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

@Component({
  selector: 'page-home',
  template: `
   <ion-stepper #stepper (selectIndexChange)="selectChange($event)">
      <ion-step label="Step1"
                description="Step1 description">
        <h2>Step1 Content</h2>
        <p>Step1 Content</p>
        <button ion-button small ionicStepperNext>Next</button>
      </ion-step>
      <ion-step label="Step2 - Step2 - Step2"
                description="Step1 description">
        <h2>Step2 Content</h2>
        <p>Step2 Content</p>
        <button ion-button color="light" small ionicStepperPrevious>Previous</button>
      </ion-step>
    </ion-stepper>
  `
})
export class HomePage {

  constructor(public navCtrl: NavController) { }

  selectChange(e) {
    console.log(e);
  }
}

API

ion-stepper

property

Name Type Default Description
[mode] 'horizontal', 'vertical' 'vertical' orientation
(selectIndexChange) EventEmitter<number> index change event

method

Name Description
nextStep(): void next step
previousStep(): void previous step
setStep(index: number): boolean set step by index

ion-step

property

Name Type Default Description
[label] string step label
[description] string step description (only vertical mode is visible)
[icon] icon 'number' step icon, default display the index (icons)
[status] 'error', '' '' step status
[errorIcon] string 'close' error status icon

[ionicStepperNext]

moves to the next step in the stepper

<button ion-button ionicStepperNext>Next</button>

[ionicStepperPrevious]

moves to the previous step in the stepper

<button ion-button ionicStepperPrevious>Previous</button>

License

This project is licensed under the MIT License - see the LICENSE file for details

ionic-stepper's People

Contributors

dependabot[bot] avatar hsuanxyz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ionic-stepper's Issues

ion-step is not a known element !

after downloading the lib and register in the app.module.ts ..adding the stepper display error in the console saying that ion-step is not a known alement ....

here is the console output


'ion-step' is not a known element:

  1. If 'ion-step' is an Angular component, then verify that it is part of this module.

  2. If 'ion-step' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("

     <ion-stepper #stepper (selectIndexChange)="selectChange($event)">
       [ERROR ->]<ion-step label="Step1"
                 description="Step1 description">
         <h2>Step1 Co"): ng:///QuestionModuleModule/QuestionPage.html@38:10
    

'ion-step' is not a known element:

  1. If 'ion-step' is an Angular component, then verify that it is part of this module.
  2. If 'ion-step' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" Next

    [ERROR ->]
    "): ng:///QuestionModule/QuestionPage.html@44:10
    'ion-stepper' is not a known element:
  3. If 'ion-stepper' is an Angular component, then verify that it is part of this module.
  4. If 'ion-stepper' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("

[Feature idea] : Make ion-step-header clickable

Hi,

Great library !
However, there is one thing that would be great: being able to click on the ...th header (especially useful on horizontal mode) to select this step.

I tried to add (click) directive to but it doesn't work.

With this feature, it would be the best stepper ever :)

Not wokring on Ionic 5.0.2

Its failing on ionic 5.0.2 initially failed with

ionic-angular import changed the import to @ionic/angular.

Now failing with below error

Uncaught Error: Template parse errors:
Can't bind to 'ngIf' since it isn't a known property of 'div'. ("                         [active]="i <= selectedIndex">
          </ion-step-header>
          <div [ERROR ->]*ngIf="!isLast" class="ionic-stepper-horizontal-line"></div>
      </ng-container>
    </div>
"): ng:///IonicStepperModule/IonicStepperComponent.html@11:15
Property binding ngIf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
                             [active]="i <= selectedIndex">
[ionic-stepper-5.0.2-error.log](https://github.com/hsuanxyz/ionic-stepper/files/3316969/ionic-stepper-5.0.2-error.log)

Be able to change label position

Hello,

I like this library very much but I believe it's missing one critical feature. It would be really great if we could change the label positions to 'bottom','top','right','left', etc..

Think about it! It will be greatly appreciated :)

Horizontal label clipped.

The horizontal labels get clipped as they are too tightly packed, would be better to add them above or below the number markers

Screenshot 2019-08-01 at 01 48 46

下一步的时候怎么提交表单

大神你好,这个插件挺好但是我在使用中有点问题,我在ionic3里是这样写的,想下一步的时候提交表单,但是直接跳下一步了,并没有执行type="submit"动作
<button type="submit" ion-button myStepperNext [disabled]="!compData.bailMethod">保存并继续,求一个解决办法

setStep to last step has no effect

Hi,
It's not possible to setStep to last step.
I think your test in setStep(index: number) about length should be :

if (index < len && index >= 0) {

instead of
if (index < len - 1 && index >= 0) {

NullInjectorError: No provider for IonicStepperComponent!

Hey,

I have an error when I tried to use ion-stepper in an ionic modal lazy loaded.

modal.module.ts

import { NgModule } from '@angular/core';
import { IonicPageModule, IonicModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { ModalPage } from './modal.page';
import IonicStepperModule from 'ionic-stepper';


@NgModule({
    declarations: [
        ModalPage
    ],
    imports: [
        IonicModule,
        IonicStepperModule,
        IonicPageModule.forChild(ModalPage),
        TranslateModule,
    ],
    entryComponents: [
        ModalPage
    ]
})
export class ModalPageModule { }
import { Component } from '@angular/core';
import { NavController, ViewController, IonicPage, App, NavParams } from 'ionic-angular';

@IonicPage({
    name: 'ModalPage',
})
@Component({
    selector: 'page-modal-component',
    templateUrl: 'modal.page.html'
})
export class ModalPage {

    form: any;

    constructor(public navCtrl: NavController,
        public viewCtrl: ViewController,
        params: NavParams) {

        this.form = params.get('form');
        console.log(this.form);
    }

    selectChange(e) {
        console.log(e);
    }

    dismiss() {
        this.viewCtrl.dismiss();
    }

}

In another page component to open the modalPage:

    startForm() {
        let myModal = this.modalCtrl.create('ModalPage', { 'form': this.component });
        myModal.present();
    }

I also add in app.module.ts import IonicStepperModule from 'ionic-stepper'; and

imports: [
    BrowserModule,
    BrowserAnimationsModule,
    IonicStepperModule,
IonicModule.forRoot(MyApp),
...

But when I opened the modal:

Uncaught (in promise): Error: StaticInjectorError[IonicStepperComponent]: \n StaticInjectorError[IonicStepperComponent]: \n NullInjectorError: No provider for IonicStepperComponent!\n_NullInjector.prototype.get@http://localhost:8100/build/vendor.js:1588:19\nresolveToken@http://localhost:8100/build/vendor.js:1876:17\ntryResolveToken@http://localhost:8100/build/vendor.js:1818:16\nStaticInjector.prototype.get@http://localhost:8100/build/vendor.js:1689:20\nresolveToken@http://localhost:8100/build/vendor.js:1876:17\ntryResolveToken@http://localhost:8100/build/vendor.js:1818:16\nStaticInjector.prototype.get@http://localhost:8100/build/vendor.js:1689:20\nresolveNgModuleDep@http://localhost:8100/build/vendor.js:11250:12\nNgModuleRef_.prototype.get@http://localhost:8100/build/vendor.js:12471:16\nresolveNgModuleDep@http://localhost:8100/build/vendor.js:11250:12\nNgModuleRef_.prototype.get@http://localhost:8100/build/vendor.js:12471:16\nresolveDep@http://localhost:8100/build/vendor.js:12967:12\ncreateClass@http://localhost:8100/build/vendor.js:12829:29\ncreateDirectiveInstance@http://localhost:8100/build/vendor.js:12676:37\ncreateViewNodes@http://localhost:8100/build/vendor.js:14114:53\ncallViewAction@http://localhost:8100/build/vendor.js:14546:13\nexecComponentViewsAction@http://localhost:8100/build/vendor.js:14455:13\ncreateViewNodes@http://localhost:8100/build/vendor.js:14142:5\ncreateRootView@http://localhost:8100/build/vendor.js:14004:5\ncallWithDebugContext@http://localhost:8100/build/vendor.js:15405:39\ndebugCreateRootView@http://localhost:8100/build/vendor.js:14706:12\nComponentFactory_.prototype.create@http://localhost:8100/build/vendor.js:11625:37\nComponentFactoryBoundToModule.prototype.create@http://localhost:8100/build/vendor.js:4587:16\nViewContainerRef_.prototype.createComponent@http://localhost:8100/build/vendor.js:11822:45\nModalCmp.prototype.ionViewPreLoad@http://localhost:8100/build/vendor.js:60281:28\nViewController.prototype._lifecycle@http://localhost:8100/build/vendor.js:19798:13\nViewController.prototype._preLoad@http://localhost:8100/build/vendor.js:19660:9\nNavControllerBase.prototype._preLoad@http://localhost:8100/build/vendor.js:53528:9\nNavControllerBase.prototype._viewInit@http://localhost:8100/build/vendor.js:53218:9\nNavControllerBase.prototype._nextTrns/<@http://localhost:8100/build/vendor.js:53029:17\nF</l</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:14974\nonInvoke@http://localhost:8100/build/vendor.js:5294:24\nF</l</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:14901\nF</c</r.prototype.run@http://localhost:8100/build/polyfills.js:3:10124\nf/<@http://localhost:8100/build/polyfills.js:3:20240\nF</l</t.prototype.invokeTask@http://localhost:8100/build/polyfills.js:3:15649\nonInvokeTask@http://localhost:8100/build/vendor.js:5285:24\nF</l</t.prototype.invokeTask@http://localhost:8100/build/polyfills.js:3:15562\nF</c</r.prototype.runTask@http://localhost:8100/build/polyfills.js:3:10815\no@http://localhost:8100/build/polyfills.js:3:7887\nF</h</e.invokeTask@http://localhost:8100/build/polyfills.js:3:16823\np@http://localhost:8100/build/polyfills.js:2:27646\nv@http://localhost:8100/build/polyfills.js:2:27893\n

Any idea?

Thanks for your help.

add:

$ ionic info

cli packages: (/home/nightbringer/.nvm/versions/node/v6.9.5/lib/node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v6.9.5
    npm               : 3.10.10
    OS                : Linux 4.13

Environment Variables:

    ANDROID_HOME : /home/nightbringer/sdk/android-sdk-linux/

Misc:

    backend : pro

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.