0.1.0 • Published 7 years ago

@adobe/target-ng-module v0.1.0

Weekly downloads
44
License
Apache-2.0
Repository
github
Last release
7 years ago

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:

KeyTypeMandatoryDescription
mboxStringYesmbox 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.
paramsObjectNombox parameters - an object of key-value pairs.
timeoutNumberNotimeout 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.