@adobe/target-ng-module
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

target-ng-module

Installation

To install this library, run:

$ npm install @adobe/target-ng-module --save

Consuming Target library module

Install the library and then from your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import the library
import { TargetModule } from '@adobe/target-ng-module';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,

    // Specify Target library as an import
    TargetModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Once the library is imported, you can use Target mbox directive in your Angular application:

// Specify Target options in your app.component.ts
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html'
})
export class AppComponent {
  targetOpts = {
    mbox: 'simpleDirective'
  };
}
<!-- You can now use Target mbox directive in app.component.html -->
<h1>
  {{title}}
</h1>
<div [mbox]="targetOpts">
  Default content
</div>

Options

The following Target options can be set on the mbox directive:

Key Type Mandatory Description
mbox String Yes mbox name. It is mandatory if you want to track clicks. If not provided, an error will be logged and tracking event won't be attached.
params Object No mbox parameters - an object of key-value pairs.
timeout Number No timeout in milliseconds. If not specified, default adobe.target will be used.

Development

To generate all *.js, *.d.ts and *.metadata.json files:

$ npm run build

To lint all *.ts files:

$ npm run lint

To publish built package, login to NPM and then publish with:

$ npm publish dist

License

Apache-2.0 © Adobe Systems Inc.

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @adobe/target-ng-module

    Weekly Downloads

    0

    Version

    0.1.0

    License

    Apache-2.0

    Last publish

    Collaborators

    • dylandepass
    • djaeggi
    • adobehalls
    • fullcolorcoder
    • marbec
    • tripod
    • garthdb
    • lazd
    • adobe-admin
    • patrickfulton
    • trieloff
    • shazron
    • krisnye
    • dcpfsdk
    • natebaldwin
    • devongovett
    • aspro83
    • symanovi
    • dpfister
    • stefan-guggisberg
    • korra
    • rofe
    • kptdobe