Skip to content
This repository has been archived by the owner on Aug 2, 2018. It is now read-only.

Adding a Component

Nick Budak edited this page Feb 26, 2018 · 1 revision

this example assumes you're developing a component for the plugin coolBiz, which was created in the Getting Started example.

scaffolding the component

let's add a component to our new plugin. we'll call it coolBizView, and keep its code in a directory in src/:

$ cd src/
$ mkdir coolBizView
$ cd coolBizView

we'll create a javascript file for the component's code and an html file for its template:

$ touch index.js
$ touch template.html

let's add the following to index.js:

import * as template from './template.html'

export default {
  template: template
}

and the following to template.html:

<h1>hello Cool Biz!!!!</h1>

to add the component to our plugin, we need to import it in src/index.js and add it to the module declaration:

import angular from 'angular'
import coolBizView from './coolBizView'

export default angular.module('myPlugin', [])
    .component('coolBizView', coolBizView)

now the component is available to be used in a custom.js that imports our plugin. to test it out, please see Testing a Plugin

adding functionality

coming soon...

Clone this wiki locally