by joe.pesch
8. September 2019 12:57
Before getting started, I recommend looking at using https://cmder.net/ for Command Editor.
Prerequisites:
- Angular installed globally:
npm install -g @angular/cli
- Visual Studio Code or Visual Studio Community (or other full version)
- Node.js v. 8.10.0 or higher (https://nodejs.org/en/download/) to check current version, run command:
node -v
Steps to create project:
- Create folder for the project, in my case "NgCore"
- Run the following command from within the project folder:
ng new NgCoreApp
- Run the following command from withing the "NgCoreApp" folder:
ng build
- Run the app from the "dist" folder (created by the "ng build")
649b4c45-5e67-49e1-b978-0daa454871bd|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
Tags:
Angular | ASP.Net Core
by joe.pesch
28. February 2018 15:11
When compiling Angular 2 application I received compile warning "Critical dependency: the request of a dependency is an expression" when using the require() method with a variable vs. literal string value (see examples below).
This throws compile warning:
let path = 'path_to_item';
let item = require(path);
This does not throw compile warning:
let item = require('path_to_item');
0e1cb8c7-7709-4b09-9513-80c2c2cb3318|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
Tags:
Angular
by joe.pesch
16. February 2018 15:08
Issue with component level styles not working, import "ViewEncapsulation: from @angular/core and add encapsulation: ViewEncapsoulation.None to the @Component decorator as shown below.
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'app-demo',
templateUrl: './demo.component.html',
styleUrls: ['./demo.component.css'],
encapsulation: ViewEncapsulation.None
})
by joe.pesch
16. February 2018 15:00
Navigate a JSON object by a dotted string path (e.g. "somePath.subPath.anotherSubPath").
console.log('somePath.subPath.anotherSubPath'.split('.').reduce((o, i) => o[i], jsonObject));
by joe.pesch
16. February 2018 14:56
Take a dotted string (e.g. "someThing.someThingElse.another") and convert first letter of each dotted component to upper or lower case.
dottedToUpper(str) {
str = str.replace(/\./g, ' ');
str = str.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1);
});
return str.replace(/ /g, '.');
}
dottedToLower(str) {
str = str.replace(/\./g, ' ');
str = str.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toLowerCase() + txt.substr(1);
});
return str.replace(/ /g, '.');
}