dimakuba / ng-noty Goto Github PK
View Code? Open in Web Editor NEWng-noty is a service for displaying notifications
ng-noty is a service for displaying notifications
Hi,
I have followed the readme instructions & imported it to a component to check.But i'm facing "Noty - is not defined" error.
Complete error description which I got in console is below.
ERROR ReferenceError: Noty is not defined
at NgNoty.create (ng-noty.ts:11)
at NotifyService.openNgNoty (notify.service.ts:21)
at SafeSubscriber.eval [as _next] (login.component.ts:48)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:238)
at SafeSubscriber.next (Subscriber.js:185)
at Subscriber._next (Subscriber.js:125)
at Subscriber.next (Subscriber.js:89)
at CatchSubscriber.Subscriber._next (Subscriber.js:125)
at CatchSubscriber.Subscriber.next (Subscriber.js:89)
at MapSubscriber._next (map.js:83)
My complete code,
app.module.ts
import {NgNoty, NotyOptions} from "ng-noty";
@NgModule({
...
providers: [NgNoty]
...
})
notify.service.ts
import { Injectable,Component } from '@angular/core';
import {NgNoty, NotyOptions} from "ng-noty";
@Component({
selector: 'app-notification',
template: `
<button (click)="openNgNoty()" aria-label="Show an example ng-noty">
Show ng-noty
</button>
`,
})
@Injectable()
export class NotifyService {
constructor(public ngNoty: NgNoty) { }
openNgNoty() {
console.log('check'); // console works
this.ngNoty.create(<NotyOptions>{ // Facing error here
text: 'Some notification text'
}).show();
}
}
login.component.ts
...
import { NotifyService } from '../notify.service';
...
export class LoginComponent implements OnInit {
constructor(private notify:NotifyService) {}
onSubmit() {
cnosole.log('check'); // console works
this.notify.openNgNoty();
}
}
Did I do anything wrong or what may be the problem ?
Regards,
Deepak
I am trying to add buttons to message. I am new to typescript and I am not sure that I understand what is happening here, but I cannot seem to get the buttons added. It looks like NotyModel.button should create a NotyButton, but I am getting an error message.
NotyModel.button is not a function
This is how I am trying to use it:
this.noty.create({
text: 'Problems Encountered',
layout: 'bottomRight',
theme: 'bootstrap-v4',
type: 'error',
buttons: [
NotyModel.button('Ok', 'btn', () => {}, null)
]
}).show();
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.