Skip to content

[Feature] Package the project as a ng library and more #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!--
IF YOU DON'T FILL OUT THE FOLLOWING INFORMATION YOUR ISSUE MIGHT BE CLOSED WITHOUT INVESTIGATING
-->
### Bug Report or Feature Request (mark with an `x`)
```
- [ ] bug report -> please search issues before submitting
- [ ] feature request
```

### OS and Version?
<!--
> Windows 7, 8 or 10. Linux (which distribution).macOS(Yosemite ? El Capitan? Sierra ?)
-->

### Versions
<!--
Output from: `ng --version`, in case you are using Angular CLI.
Otherwise, output from: `node --version` , `npm --version` and Angular version.
-->


### Repro steps
<!--
Simple steps to reproduce this bug.
Please include: commands run, packages added, related code changes.
A link to a sample repo would help too.
-->


### The log given by the failure
<!-- Normally this include a stack trace and some more information. -->


### Desired functionality
<!--
What would like to see implemented?
What is the usecase?
-->


### Mention any other details that might be useful
<!-- Please include a link to the repo if this is related to an OSS project. -->
87 changes: 42 additions & 45 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,45 +1,42 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages
typings

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# Generated files
app/**/*.js
app/**/*.js.map

# VS Code settings
.vscode
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings
/config/gulp-tasks/README.md

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
sudo: required
dist: trusty

#install google chrome, using addons
addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable

language: node_js
node_js:
- "6"

before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm install --quiet -g gulp-cli

script: gulp test:ci

after_success: gulp coveralls
26 changes: 26 additions & 0 deletions .yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"generator-ngx-library": {
"authorName": "Jason Watmore",
"authorEmail": "[email protected]",
"githubUsername": "cornflourblue",
"projectName": "ngx-alert-notifications",
"projectVersion": "0.0.1",
"projectDescription": "Alert notifications module for Angular.",
"projectKeywords": [
"ng",
"angular",
"alert",
"notifications"
],
"ngPrefix": "nga",
"ngVersion": "2.0.0",
"ngModules": [
"core",
"common",
"router",
"platform-browser"
],
"useGreenkeeper": false,
"useCompodoc": true
}
}
Empty file added CHANGELOG.md
Empty file.
31 changes: 16 additions & 15 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ The MIT License (MIT)

Copyright (c) 2017 Jason Watmore

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
138 changes: 135 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,137 @@
# angular2-alert-notifications
<p align="center">
<img height="256px" width="256px" style="text-align: center;" src="https://cdn.rawgit.com/cornflourblue/ngx-alert-notifications/master/demo/src/assets/logo.svg">
</p>

Angular 2/4 - Alert (Toaster) Notifications
# ngx-alert-notifications - Alert notifications module for Angular.

[![npm version](https://badge.fury.io/js/ngx-alert-notifications.svg)](https://badge.fury.io/js/ngx-alert-notifications)
[![Build Status](https://travis-ci.org/cornflourblue/ngx-alert-notifications.svg?branch=master)](https://travis-ci.org/cornflourblue/ngx-alert-notifications)
[![Coverage Status](https://coveralls.io/repos/github/cornflourblue/ngx-alert-notifications/badge.svg?branch=master)](https://coveralls.io/github/cornflourblue/ngx-alert-notifications?branch=master)
[![dependency Status](https://david-dm.org/cornflourblue/ngx-alert-notifications/status.svg)](https://david-dm.org/cornflourblue/ngx-alert-notifications)
[![devDependency Status](https://david-dm.org/cornflourblue/ngx-alert-notifications/dev-status.svg?branch=master)](https://david-dm.org/cornflourblue/ngx-alert-notifications#info=devDependencies)

## Demo

View all the directives in action at https://cornflourblue.github.io/ngx-alert-notifications

## Dependencies
* [Angular](https://angular.io) (*requires* Angular 2 or higher, tested with 2.0.0)

## Installation
Install above dependencies via *npm*.

Now install `ngx-alert-notifications` via:
```shell
npm install --save ngx-alert-notifications
```

---
##### SystemJS
>**Note**:If you are using `SystemJS`, you should adjust your configuration to point to the UMD bundle.
In your systemjs config file, `map` needs to tell the System loader where to look for `ngx-alert-notifications`:
```js
map: {
'ngx-alert-notifications': 'node_modules/ngx-alert-notifications/bundles/ngx-alert-notifications.umd.js',
}
```
---

Once installed you need to import the main module:
```js
import { NgaAlertModule } from 'ngx-alert-notifications';
```
The only remaining part is to list the imported module in your application module. The exact method will be slightly
different for the root (top-level) module for which you should end up with the code similar to (notice ` NgaAlertModule.forRoot()`):
```js
import { NgaAlertModule } from 'ngx-alert-notifications';

@NgModule({
declarations: [AppComponent, ...],
imports: [NgaAlertModule.forRoot(), ...],
bootstrap: [AppComponent]
})
export class AppModule {
}
```

Other modules in your application can simply import ` NgaAlertModule `:

```js
import { NgaAlertModule } from 'ngx-alert-notifications';

@NgModule({
declarations: [OtherComponent, ...],
imports: [NgaAlertModule, ...],
})
export class OtherModule {
}
```

## Usage

Once the module is imported, you can use the `NgaAlertService` in your component (i.e. `HomeComponent`) to display different types of notifications.

Here is how it works:

```ts
import { Component} from '@angular/core';
import { NgaAlertService } from 'ngx-alert-notifications';


@Component({
selector: 'app-home',
templateUrl: `./home.component.html'`,
styleUrls: ['./home.component.scss']
})
export class HomeComponent{

constructor(private alertService: NgaAlertService) { }

success(message: string) {
this.alertService.success(message);
}

error(message: string) {
this.alertService.error(message);
}

info(message: string) {
this.alertService.info(message);
}

warn(message: string) {
this.alertService.warn(message);
}

clear() {
this.alertService.clear();
}
}
```


and here, the related component template:

```html
<div class="container">
<div class="row">
<div class="col-md text-center">
<button class="btn btn-success" (click)="success('Success!!')"><i class="fa fa-bell" aria-hidden="true"></i> Success</button>
<button class="btn btn-danger" (click)="error('Error :(')"><i class="fa fa-bell" aria-hidden="true"></i> Error</button>
<button class="btn btn-info" (click)="info('Some info....')"><i class="fa fa-bell" aria-hidden="true"></i> Info</button>
<button class="btn btn-warning" (click)="warn('Warning: ...')"><i class="fa fa-bell" aria-hidden="true"></i> Warn</button>
<button class="btn btn-default" (click)="clear()"><i class="fa fa-bell-slash" aria-hidden="true"></i> Clear</button>
</div>
<div class="col-md text-center">
<p class="text-muted">Your alerts will appear here...</p>
<nga-alert></nga-alert>
</div>

</div>
```


## License

Copyright (c) 2017 Jason Watmore. Licensed under the MIT License (MIT)

To see a demo and further details go to http://jasonwatmore.com/post/2017/06/25/angular-2-4-alert-toaster-notifications
Loading