angular - Angular2: Why isn't my component's console.log not logging anything -
this component's code, non of versions anything. blank console in browser.
export class assetscomponent { s = 'hello2'; constructor() { this.s = 'ds'; console.log(this.s); <--- nothing console.log('test'); <--- nothing console.log(s); <--- breaks compiler } }
it's possible component isn't being loaded. didn't include code showing whole component file or app.module file should included. it's possible isn't compiling, because trying access variable doesn't exist:
console.log(s); <--- breaks compiler
there no variable 's' in constructor can access. needs this.s or need define variable s in within constructor function:
let s = 'something';
Comments
Post a Comment