angular8

Angular 8 using sails js websokcet (sokcet.io)

倖福魔咒の 提交于 2019-12-02 10:13:31
I want to connect angular 8 in front to sails js in backend through websocket. but my code doesn't work. may someone help on way in backend i just did following: in controller: /** * SocketController * * @description :: Server-side actions for handling incoming requests. * @help :: See https://sailsjs.com/docs/concepts/actions */ module.exports = { subscribe: function(req, res) { if( ! req.isSocket) { return res.badRequest(); } console.log('here is socket'); // sails.sockets.join(req.socket, 'feed'); // var roomName = req.param('roomName'); var roomName = 'feed'; sails.sockets.join(req,

After update to Angular 8 CLI throws “.getColorDepth is not a function”

不打扰是莪最后的温柔 提交于 2019-12-01 22:45:16
问题 A collegue of mine upgraded our project to angular 8. I pulled his branch and run npm install . On his branch everyhing works fine. I do now get the same error every time i run any "ng ..." command: C:\xxx\party-ui\node_modules\@angular\cli\utilities\color.js:15 process.stdout.getColorDepth() > 1; ^ TypeError: process.stdout.getColorDepth is not a function at Object.<anonymous> (C:\xxx\party-ui\node_modules\@angular\cli\utilities\color.js:15:20) at Module._compile (module.js:652:30) at Object

Angular 8 - Lazy loading modules : Error TS1323: Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'

痴心易碎 提交于 2019-11-28 06:13:38
When I updated Angular from 7 to Angular 8, getting error for lazy loading modules I have tried the options, which are there in the angular upgradation guide Made the below changes: Before loadChildren: '../feature/path/sample- tage.module#SameTagModule' After loadChildren: () => import('../feature/path/sample- tags.module').then(m => m.CreateLinksModule) error TS1323: Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'. You are using dynamic import so you have to change your tsconfig.json like this to target your code to esnext module { "compileOnSave": false,

How should I use the new static option for @ViewChild in Angular 8?

给你一囗甜甜゛ 提交于 2019-11-28 04:27:13
How should I configure the new Angular 8 view child? @ViewChild('searchText', {read: ElementRef, static: false}) public searchTextInput: ElementRef; vs @ViewChild('searchText', {read: ElementRef, static: true}) public searchTextInput: ElementRef; Which is better? When should I use static:true vs static:false ? In most cases you will want to use {static: false} . Setting it like this will ensure query matches that are dependent on binding resolution (like structural directives *ngIf, etc... ) will be found. Example of when to use static: false : @Component({ template: ` <div *ngIf="showMe"

How to use the activated route's data DIRECTLY in the HTML template containing the RouterOutlet?

时光毁灭记忆、已成空白 提交于 2019-11-28 01:28:35
This one took me a while to figure out, so I hope to save someone's time by sharing the solution in the SO's Q&A way. Here it goes: Goal I have an Angular8 web application, where I use the RouterModule to navigate between the components. Here is how my routes are defined: const routes: Routes = [ { path: 'moo', component: AppMooComponent, data: { title: 'Moo Section', desc: 'Moo is the first example component.' } }, { path: 'boo', component: AppBooComponent, data: { title: 'Boo Section', desc: 'Boo is the second example component.' } }, { path: 'foo', component: AppFooComponent, data: { title:

Angular 8 project not working in Microsoft Edge and IE11

我们两清 提交于 2019-11-27 07:19:26
问题 I need to make my Angular project work on both IE11 and Edge, but a very simple hello world is not even showing in these two browsers. Here's what I did: npm version: $npm -v 6.10.2 Angular version: $ng v Angular CLI: 8.1.3 Node: 10.15.1 OS: win32 x64 Angular: 8.1.3 ... animations, cli, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router Package Version ----------------------------------------------------------- @angular

Angular 8 - Lazy loading modules : Error TS1323: Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'

喜你入骨 提交于 2019-11-26 19:39:49
问题 When I updated Angular from 7 to Angular 8, getting error for lazy loading modules I have tried the options, which are there in the angular upgradation guide Made the below changes: Before loadChildren: '../feature/path/sample- tage.module#SameTagModule' After loadChildren: () => import('../feature/path/sample- tags.module').then(m => m.CreateLinksModule) error TS1323: Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'. 回答1: You are using dynamic import so you

How do I support Internet Explorer in an Angular 8 application?

旧时模样 提交于 2019-11-26 10:56:04
问题 When I generate a project with Angular CLI (8.0.0), I run ng serve , open the application up in Internet Explorer and I am presented with a blank screen. I had a look at the polyfills.ts files and I uncommented the following lines: import \'classlist.js\'; import \'web-animations-js\'; I\'ve also removed all core.js imports as Angular 8 supports core.js 3.0 directly. I\'ve also ran npm i . package.json: \"dependencies\": { \"@angular/animations\": \"~8.0.0\", \"@angular/common\": \"~8.0.0\",

How should I use the new static option for @ViewChild in Angular 8?

我只是一个虾纸丫 提交于 2019-11-26 09:17:03
问题 How should I configure the new Angular 8 view child? @ViewChild(\'searchText\', {read: ElementRef, static: false}) public searchTextInput: ElementRef; vs @ViewChild(\'searchText\', {read: ElementRef, static: true}) public searchTextInput: ElementRef; Which is better? When should I use static:true vs static:false ? 回答1: In most cases you will want to use {static: false} . Setting it like this will ensure query matches that are dependent on binding resolution (like structural directives *ngIf,

Importing json file in TypeScript

佐手、 提交于 2019-11-26 04:13:08
问题 I have a JSON file that looks like following: { \"primaryBright\": \"#2DC6FB\", \"primaryMain\": \"#05B4F0\", \"primaryDarker\": \"#04A1D7\", \"primaryDarkest\": \"#048FBE\", \"secondaryBright\": \"#4CD2C0\", \"secondaryMain\": \"#00BFA5\", \"secondaryDarker\": \"#009884\", \"secondaryDarkest\": \"#007F6E\", \"tertiaryMain\": \"#FA555A\", \"tertiaryDarker\": \"#F93C42\", \"tertiaryDarkest\": \"#F9232A\", \"darkGrey\": \"#333333\", \"lightGrey\": \"#777777\" } I\'m trying to import it into a