Storybook Addon for AngularJS (1.x)
Note This addon is intended to be used with
@storybook/html
, available since Storybook 4.
Installation
Use your favorite devDependencies
:
npm:
npm install --save-dev storybook-addon-angularjs
Yarn:
yarn add --dev storybook-addon-angularjs
Usage
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.
License
Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.