Skip to content

Angular Code Sample to demonstrate the usage of the OneSignal NPM package to receive push notifications

License

Notifications You must be signed in to change notification settings

OneSignalDevelopers/OneSignal-Angular-NPM-Sample

Repository files navigation

Push Notifications In Angular With OneSignal

This project demonstrates the usage of OneSignal NPM package to add push notification to your Angular project.

How-to guide

Read our official how-to guide to demonstrate the usage of push notification using the OneSignal npm package and Angular.

Create a FREE OneSignal Account

Sign up for a free OneSignal account

OneSignal NPM Package

NPM Packge: OneSignal-Ngx

Install OneSignal NPM Package

npm i onesignal-ngx

Use OneSignal NPM Package

import { OneSignalService } from 'onesignal-ngx';

Use the OneSignal NPM Package

Initialize OneSignal with your OneSignal AppId:

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'angular-example-app';

  constructor(private oneSignal: OneSignalService) {
    this.oneSignal.init({
      appId: "YOUR-ONESIGNAL-APP-ID-HERE",
    });
  }
}

Add Tags To Segment Users

If you want to learn more about OneSignal data tags to segment your users, visti our official docs.

this.os.sendTag("tech", tag).then(() => {
  console.log("Sent tag: " + tag);
});

About

Angular Code Sample to demonstrate the usage of the OneSignal NPM package to receive push notifications

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published