A simple addon to create Storybook stories with AngularJS components.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 5ddeb8b Dec 3, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib refactor angularjs utils to improve stories readability Jul 14, 2018
.gitignore add some files with a first working version of storybook with angular… Jul 12, 2018
LICENSE initial commit Jul 12, 2018
README.md update readme Dec 4, 2018
package-lock.json 0.0.2 Jul 15, 2018
package.json 0.0.2 Jul 15, 2018

README.md

Storybook Addon for AngularJS (1.x)

Note This addon is intended to be used with @storybook/html, available with Storybook 4.

Usage

Install the package:

npm i -D storybook-addon-angularjs

Create your stories with:

import { storiesOf } from "@storybook/html";

import { withKnobs, text, number } from "@storybook/addon-knobs";
import { action } from "@storybook/addon-actions";

import { forModule } from "storybook-addon-angularjs";

storiesOf("Components/Demo", module)
  .addDecorator(withKnobs)
  .add(
    "default",
    forModule("myApp").createElement(compile => {
      const name = text("Name", "Jane");

      const foo = {
        bar: number("Value", 20, { range: true, min: 0, max: 30, step: 1 })
      };

      const onEvt = action("clicked");

      return compile`<demo-component name="${name}" foo="${foo}" on-ev="${onEvt}(num, name)"></demo-component>`;
    })
  );

See a full working example here.