Przejdź do głównej zawartości

Angular2 + Moment.js library with Visual Studio 2017 .Net Core 2.0

Hey there!
Recently I was facing problem with adding MomentJs library to Angular2 in .net core 2.0 project.
 I'm using Visual Studio 2017 15.3.3.
 (https://www.visualstudio.com/pl/thank-you-downloading-visual-studio/?sku=Community&rel=15)


  1. Create new test project


2. Use Web -> Angular template 

3. Compile and run in chrome to check that everything is ok. 

4. Edit package.json. At the end of "dependencies" add new line: 
"moment": "2.18.1"


5. Edit tsconfig.json file,
At "compilerOptions" add: "allowSyntheticDefaultImports": true,



6. Edit home.component.ts and add:

import * as moment from 'moment';

and the constructor.
    constructor() {
        try {
            console.log("test");
            let now = moment().format('LLLL');
            console.log(now);
        } catch (e) {
            console.log(e);
        }
    }

set breakpoints





and enjoy Moment library! 




Komentarze

Popularne posty z tego bloga

X Mapper 1.0 - Tool for mapping X Panel Button

I've made an application that allows simple mapping / binding exe files to X Panel Button (via editing registry file, SOFTWARE\\SonyEricsson\\PanelManager) I think that using my X Mapper is faster and easier then manual editing registry... Instruction: 1. if it's first time do Backup of registry entry and panelmanager.lnk in StartUp folder! a) (go to Menu->Backup->Save) b) (Menu->panelmanager.lnk->beckup before delete) 2. then we have to delete panelmanager.lnk from our StartUp folder (Menu->panelmanager.lnk->try to delete) 3. Choose one from available Events: - Run Program (allows to run program) - Run Program with Argument (allows to run any other application but with additional argument (uses my RWA app, see my signature) - Toggle WiFi (changes state of Wifi Adapter, uses external exe) - Toggle BT (changes state of BT Adapter, uses external exe) - Lock (devicelock.exe is executed) 4. if Run Program / Run Program with Argument is selected then press: "C...

Custom Scroll 1.0 - PPC Application for HTC

Hi All, I would like to present You a small and simple application called Custom Scroll. It gives You a chance to take the opportunity customizing scrolling behavior of HTCScroll Windows addon (which is used in File Explorer, MS Contacts, Programs, Settings... - everywhere where scrolls are used - and we are using fingers (flick gestures) to scroll... I've noticed that when I'm trying new ROM many times "scrolling feature" need to be modified by myself, so why don't we just make it quick and simple, with predefined checked and accepted values - even maybe "solutions" ? that's why I've made that application... I would like to ask You a favor... when You'll be testing Your own values and You'll notice that some of combinations are quite good, please post them 'here' - in this topic ... after testing I'll build them into program. Please take a look at the video, where I'm showing how does Custom Scroll works and how to operat...

Send WinKey - Open Start Menu...

Send WinKey is tiny application that is emulating click of Windows Key... * You can use it while binding / mapping your hardware keys (ex Xperia, Touch Pro etc.) when You need the "fast" opening of Start menu (not touching screen but pressing the button...) Cab Installation XDA-Developers Thread *(yesssss... I know that MortScript has got that kind of options... but ... not everybody needs to have mortscript installed... or not everybody wants to edit those lines of scripts/codes... etc) :) cheers...