-
Notifications
You must be signed in to change notification settings - Fork 28
Angular2 Directive
Angular2 Directive extension for at.js library provides a "flicker-free" implementation of an mbox Target directive, to be used in Angular2 components.
- AT.js library
- Angular2 app
- Include at.js in your
.angular-cli.json'sscriptsconfiguration array; - Install the extension from NPM:
npm install @adobe/target-ng-module -P; - Import Target directive and service in your AppModule:
import ...
import { TargetModule } from '@adobe/target-ng-module';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
// Specify Target library as an import
TargetModule
],
...- 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 -->
<div [mbox]="targetOpts">
Default content
</div>Additional Target options can be specified in targetOpts, such as timeout and at.js params.
For more details, check out the extension README and see the demo in action.
These extensions are provided free to developers as a starting point to integrate at.js with their Single Page Application. Extensions are not always updated for the latest at.js version. Customization may be required to integrate successfully with your single page app.
Issues: place send feedback and questions through Github issues. We will respond as best we can. Please note, these extensions are not supported by Adobe Client Care or Target Engineering.