This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Retrieves quantities for particular product, by a given product color | |
* | |
* @param productId | |
*/ | |
@GET("/products/{id}/quantities") | |
public getProductQuantities(@Path("id") id: number, @Query("color") color: number): Observable<any> { return null; }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker | |
.register('/service-worker.js') | |
.then(function(registration) { | |
console.log('Service Worker registered'); | |
}).catch(function(err) { | |
console.log('Service Worker registration failed: ', err); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
navigateFallback: '/index.html', | |
stripPrefix: './dist', | |
root: '../root/', | |
staticFileGlobs: [ | |
'./dist/index.html', | |
'./dist/**.js', | |
'./dist/**.css', | |
'./dist/**.ttf', | |
'./dist/assets/images/*', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Capitalizes the first character in given string | |
* @param s | |
*/ | |
export function capitalize(s: string) { | |
if (!s || typeof s !== 'string') return s; | |
return s && s[0].toUpperCase() + s.slice(1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Translates given message code and title code and | |
* displays corresponding notification | |
* | |
* @param msgCode | |
* @param type | |
* @param titleCode | |
*/ | |
public displayNotification(msgCode: string, type: string = 'info', titleCode?: string) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mergeAndSaveJsonFiles(src, dest) { | |
jsonConcat({ src: src, dest: dest }, | |
(res) => console.log('Localization files successfully merged!'); | |
); | |
} | |
// Merge all localization files into one | |
mergeAndSaveJsonFiles(localizationSourceFilesEN, "./i18n/en.json"); | |
mergeAndSaveJsonFiles(localizationSourceFilesHR, "./i18n/hr.json"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private setupLanguage(): void { | |
// Load localization object from the confguration | |
let localization: any = this.configService.get('localization'); | |
// Save language codes as an array | |
let languages: Array<string> = localization.languages.map(lang => lang.code); | |
// Get browser’s default language | |
let browserLang: string = this.translate.getBrowserLang(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
translateService.get('HeaderTitle').subscribe( | |
value => { | |
let alertTitle = value; | |
} | |
) | |
let title = translateService.instant('HeaderTitle'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TranslateModule } from 'ng2-translate'; | |
@NgModule({ | |
imports: [ | |
TranslateModule.forRoot() | |
], | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { APP_INITIALIZER } from '@angular/core'; | |
export function configServiceFactory (config: ConfigService) { | |
return () => config.load() | |
} | |
... | |
@NgModule({ | |
... | |
providers: [ | |
... |
NewerOlder