-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from XDex/TNT-27423
TNT-27423 Angular 2 support for AT.js
- Loading branch information
Showing
17 changed files
with
7,583 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Node | ||
node_modules/* | ||
npm-debug.log | ||
|
||
# TypeScript | ||
src/*.js | ||
src/*.map | ||
src/*.d.ts | ||
|
||
# JetBrains | ||
.idea | ||
.project | ||
.settings | ||
.idea/* | ||
*.iml | ||
|
||
# VS Code | ||
.vscode/* | ||
|
||
# Windows | ||
Thumbs.db | ||
Desktop.ini | ||
|
||
# Mac | ||
.DS_Store | ||
**/.DS_Store | ||
|
||
# Ngc generated files | ||
**/*.ngfactory.ts | ||
|
||
# Build files | ||
dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Node | ||
node_modules/* | ||
npm-debug.log | ||
docs/* | ||
# DO NOT IGNORE TYPESCRIPT FILES FOR NPM | ||
# TypeScript | ||
# *.js | ||
# *.map | ||
# *.d.ts | ||
|
||
# JetBrains | ||
.idea | ||
.project | ||
.settings | ||
.idea/* | ||
*.iml | ||
|
||
# VS Code | ||
.vscode/* | ||
|
||
# Windows | ||
Thumbs.db | ||
Desktop.ini | ||
|
||
# Mac | ||
.DS_Store | ||
**/.DS_Store | ||
|
||
# Ngc generated files | ||
**/*.ngfactory.ts | ||
|
||
# Library files | ||
src/* | ||
build/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
language: node_js | ||
sudo: false | ||
node_js: | ||
- '4.2.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"generator-angular2-library": { | ||
"promptValues": { | ||
"gitRepositoryUrl": "https://github.com/Adobe-Marketing-Cloud/target-atjs-extensions" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# target-ng-module | ||
|
||
## Installation | ||
|
||
To install this library, run: | ||
|
||
```bash | ||
$ npm install @adobe/target-ng-module --save | ||
``` | ||
|
||
## Consuming Target library module | ||
|
||
Install the library and then from your Angular `AppModule`: | ||
|
||
```typescript | ||
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: | ||
|
||
```javascript | ||
// Specify Target options in your app.component.ts | ||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html' | ||
}) | ||
export class AppComponent { | ||
targetOpts = { | ||
mbox: 'simpleDirective' | ||
}; | ||
} | ||
``` | ||
|
||
```xml | ||
<!-- 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: | ||
|
||
```bash | ||
$ npm run build | ||
``` | ||
|
||
To lint all `*.ts` files: | ||
|
||
```bash | ||
$ npm run lint | ||
``` | ||
|
||
To publish built package, login to NPM and then publish with: | ||
```bash | ||
$ npm publish dist | ||
``` | ||
|
||
## License | ||
|
||
Apache-2.0 © [Adobe Systems Inc.](mailto:[email protected]) |
Oops, something went wrong.