flauc / ng-push Goto Github PK
View Code? Open in Web Editor NEWAn Angular wrapper around the Notifications API
License: MIT License
An Angular wrapper around the Notifications API
License: MIT License
i am talking about this:
https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web?hl=en
or updated one
https://developers.google.com/web/fundamentals/push-notifications/
does this package work using Service Workers in chrome?
Label it as question or feature request.
Getting this error on ng serve:
ng-push.d.ts, found version 4, expected 3
Hi! The ng-push after built and deployed doesnot ask for permission. And when i send in the push, it shows that the user has not granted permission for push.
Its working on localhost though. Great job with the plugin.
Hi, I am running into issues with this package in Angular 9 using Ivy.
Here is the error when building the project:
ERROR in node_modules/ng-push/index.d.ts:3:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgMod
ule class.
This likely means that the library (ng-push) which declares PushNotificationsModule has not been processed correctly by ngcc, or is not compatibl
e with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to
see if the library is expected to be compatible with Ivy.
3 export declare class PushNotificationsModule {
How can I get user's ID (to know which one to send the notification)?
_pushNotifications.requestPermission();
is just a simple void...
I use my Angular application from phones, Android or IOS and notifications are not shown. It is worth clarifying that if you ask for the permits.
Is it a kind of bug? Or is it not implemented for phones?
Hi,
When I'm opening my app, it doesn't display the request permission to show the notification push, this error occur: [Deprecation] The Notification API may no longer be used from insecure origins. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
What's can be?
Thanks,
Best Regards,
Hello!
Do you have plans for angular 7 support?
When I install ng-push on angular 7 app I've got this issues:
warning " > [email protected] " has incorrect peer dependency "@angular/core@^6.0.0".
Greetings,
thank you
i want when click to notification to open a new window
i did this code but is doesnt work
`let opiotns= {
body: res.data[0].title,
icon: this.imgUrl + '100x100/' + res.data[0].image,
timeOut: 5000,
showProgressBar: true,
clickToClose: true,
preventLastDuplicates: true
}
this._pushNotifications.create('',opiotns).subscribe(
res.onclick = window.open(this.siteUrl + 'news/' + res.data[0].id)
);`
Thank for advance, can I open my navigator when I presed in the notificartion?
Regards
Is there a way to limit the number of notifications. Also notification only if the tab is not active.
Can ng-push have requestPersmission to resolve into granted or denied. That would allow us to give certain information on what they will be lacking if denied.
For example:
this._push.requestPersmission.then((res)=>{
if(res=='granted')
console.log('welcome')
})
When I install this script in a server/client environment, I have this error:
ReferenceError: the window is not defined
I solved it so far, like this:
To make co-exist with the SSR by importing the module in my browser-app. module. ts and not in the app. module. ts
├── app
│ ├── app.component.ts
│ ├── app.browser.module.ts
│ └── app.server.modue.ts
.......
├── index.html
├── main.browser.ts
└── main.server.ts
And in my component:
import { Component, OnInit, OnDestroy, Inject, PLATFORM_ID, Injector } from '@angular/core';
import {isPlatformBrowser } from '@angular/common';
...
@Component({ ...
})
export class HomeView implements OnInit, OnDestroy {
...
private _push:PushNotificationsService;
constructor(
@Inject(PLATFORM_ID) platformId: string,
private injector: Injector,
...
) {
this.testBrowser = isPlatformBrowser(platformId);//Boolean
if (this.testBrowser)this._push=this.injector.get(PushNotificationsService);//inject service only on browser platform
}
and it works well
ERROR TypeError: Failed to construct 'Notification': Illegal constructor. Use ServiceWorkerRegistration.showNotification()
This happens on mobile. Chrome on Android to be specific.
Explanation here:
https://stackoverflow.com/a/29915743/331021
I think the library is great for Angular projects, it was very easy to use and it's a shame it doesn't work on phone.
I would fix this myself, but I'm not very good with JavaScript and this seems to require some additional logic:
https://developers.google.com/web/fundamentals/primers/service-workers/registration
npm WARN [email protected] requires a peer of @angular/core@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rxjs@^5.5.0 but none is installed. You must install peer dependencies yourself.
Currently this project does not support Angular 4.x.
What do we need to change to implement the support?
When I import the module in this way:
import { PushNotificationsModule } from 'ng-push';
...
@NgModule({
imports: [
...
PushNotificationsModule,
...
I get this runtime error
Uncaught Error: Unexpected value 'PushNotificationsModule' imported by the module 'SharedModule'. Please add a @NgModule annotation.
I've upgraded to angular 5.0.0 and now try to use ng-push instead of angular2-notifications.
Browser Chrome Version 62.0.3202.75
angular 5.0.0
tslint 5.8.0
typescript 2.6.1
webpack 3.8.1
zone.js 0.8.18
zone.js:196 Uncaught Error: Unexpected value 'PushNotificationsModule' imported by the module 'AppModule'. Please add a @NgModule annotation.
at syntaxError (compiler.js:685)
at eval (compiler.js:15307)
at Array.forEach (<anonymous>)
at CompileMetadataResolver.getNgModuleMetadata (compiler.js:15290)
at CompileMetadataResolver.getNgModuleSummary (compiler.js:15217)
at eval (compiler.js:15305)
at Array.forEach (<anonymous>)
at CompileMetadataResolver.getNgModuleMetadata (compiler.js:15290)
at JitCompiler._loadModules (compiler.js:33703)
at JitCompiler._compileModuleAndComponents (compiler.js:33664)
I'm trying to navigate to an url when clicking on the push notification, the template is rendering very slowly.
Hi, I am trying to use the ng push, and everything works fine, except playing the sound. I am passing the sound normally with the url as a string. This is my option object:
{ body: "Mensaje", icon: "../assets/img/logo/klogin.png", sound: "../assets/sounds/notification.mp3", silent: false }
The notification displays fine. It is even showing the icon correctly, but the sound never plays. Can anybody help me with this?, please.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.