Skip to content

Instantly share code, notes, and snippets.

@easierbycode
Last active August 21, 2018 21:58
Show Gist options
  • Save easierbycode/5b8feda5b4c41287b93a10399f46fe94 to your computer and use it in GitHub Desktop.
Save easierbycode/5b8feda5b4c41287b93a10399f46fe94 to your computer and use it in GitHub Desktop.
porting AngularJS - Angular 6 (https://github.com/nordus/homeclub-web)

to create PWA:

ng add @angular/pwa [this will create app/manifest.json]

  • ?: doesn't seem to work from CLI in angular-electron app
// shared/notifier.service.ts
// -OR-
// common/toastr.service.ts
import { Injectable } from '@angular/core';
// tell compiler toastr is declared elsewhere
let declare toastr:any
toastr.options = {
closeButton : true,
timeOut : '600000'
}
// @Injectable decorator is only rq'd if your service injects other services
@Injectable()
export class Notifier {
error( title : string, msg? : string ) { toastr.error( msg, title ) }
info( title : string, msg? : string ) { toastr.info( msg, title ) }
success( title : string, msg? : string ) { toastr.success( msg, title ) }
}
{
"build" : {
"options" : {
"styles": [
"node_modules/toastr/build/toastr.min.css"
],
"scripts": [
"node_modules/toastr/build/toastr.min.js"
]
}
}
}
# /services/admin/notifier.coffee
define ['ng', 's/services', 'toastr'], (angular, services, toastr) ->
toastr.options =
closeButton : true
timeOut : '600000'
services.factory 'notifier', ->
error : (title, msg) ->
toastr.error msg, title
info : (title, msg) ->
toastr.info msg, title
success : (title, msg) ->
toastr.success msg, title
{
"name" : "HomeClub",
"short_name" : "HomeClub",
"theme_color" : "#136d6d",
"background_color" : "#fafcfe",
"display" : "standalone",
"scope" : "/",
"start_url" : ".",
"icons" : [
{
"src" : "favicon.256x256.png",
"sizes" : "256x256",
"type" : "image/png"
},
{
"src" : "favicon.512x512.png",
"sizes" : "512x512",
"type" : "image/png"
}
]
}
{
"index" : "/index.html",
"assetGroups" : [{
"name" : "app",
"installMode" : "prefetch",
"resources" : {
"files" : [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name" : "assets",
"installMode" : "lazy",
"updateMode" : "prefetch",
"resources" : {
"files" : [
"/assets/**"
]
}
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment