Nationwide Polamorous Matrimony
    Wondering what’s next for npm?Check out our public roadmap! »

    ng-elm
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0 • Public • Published

    ng-elm

    This package lets you embed Elm programs inside of Angular components.
    Based off of: https://github.com/evancz/react-elm-components

    Installation

    npm install ng-elm --save

    Example

    • Elm Buttons - Code

    Usage

    After compiling your Elm program into JavaScript, you can embed it in Angular.
    This example uses the Elm buttons program :

    import { NgModule, Component, OnInit } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { NgElmModule } from 'ng-elm';
    import { Elm } from './buttons.js';
     
    @Component({
      selector: 'my-app',
      template: '<ng-elm [src]="Buttons"></ng-elm>',
    })
    class AppComponent implements OnInit {
      Buttons: any;
     
      ngOnInit() {
        this.Buttons = Elm.Buttons;
      }
    }
     
    @NgModule({
      bootstrap: [AppComponent],
      declarations: [AppComponent],
      imports: [BrowserModule, NgElmModule],
    })
    export class AppModule {}

    Note that flags (data passed into your Elm program from Angular), and ports are also implemented.

    Install

    npm i ng-elm

    DownloadsWeekly Downloads

    17

    Version

    2.0.0

    License

    BSD-3-Clause

    Unpacked Size

    14.2 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar