I have service which returns an observable which does an http request to my server and gets the data. I want to use this data but I always end up getting undefined. What's the problem?  Service:  @Injectable() export class EventService {    con...
I have this module which componentize the external library together with additional logic without adding the <script> tag directly into the index.html:  import 'http://external.com/path/file.js' //import '../js/file.js'  @Comp...
I have some code:  baseTypes.ts  export namespace Living.Things {   export class Animal {     move() { /* ... */ }   }   export class Plant {     photosynthesize() { /* ... */ }   } }   dog.ts  import b = require('./baseTypes');  export nam...
I am having a hard time trying to get the lodash modules imported. I've setup my project using npm+gulp, and keep hitting the same wall. I've tried the regular lodash, but also lodash-es.  The lodash npm package: (has an index.js file in th...
I'm looking at implementation of private members in TypeScript, and I find it a little confusing. Intellisense doesn't allow to access private member, but in pure JavaScript, it's all there. This makes me think that TS doesn't imple...
This is What I Want To Do.  @Component({    selector: "data",    template: "<h1>{{ getData() }}</h1>" })  export class DataComponent{     this.http.get(path).subscribe({        res => return res;     }) }   If getData...
First of all, let me make it clear that what I'm looking isn't a union type but a straight up concatenation i.e "Hel" + "lo" = "Hello" but for string literal types  Essentially I have a function which takes two strin...
Suppose that I have class like this (written in typescript) and I bundle it with webpack into bundle.js.  export class EntryPoint {     static run() {         ...     } }   In my index.html I will include the bundle, but then I would also like to c...
I want to convert an array of objects to object with key value pairs in javascript.  var arr=[{"name1":"value1"},{"name2":"value2"},...}];   How can i convert it to an object such as  {"name1":"value1"...
I came across this construct in an Angular example and I wonder why this is chosen:  _ => console.log('Not using any parameters');   I understand that the variable _ means don't care/not used but since it is the only variable is ther...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.