Where is "myObj" defined?
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Next question: why are you using the square bracket notation? Why not: myObj.mykey?
Also.... Are you sure you've initialized myObj?
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `<h1>My First Angular 2 App</h1>
{{myObj['test']}}
<pre>{{myObj|json}}</pre>
`
})
export class AppComponent {
myObj = {}
ngOnInit() {
this.myObj= {test : "hello"}
}
}
@Pipe({name: 'matchkey'})
export class MatchkeyPipe implements PipeTransform {
transform(obj:any, keys:any[]):any {
try {
if (obj && keys) {
return keys.find(key => obj[key])
}
} catch (e) {
console.log('...objectkey error ', e);
}
}
}
ngOnInit() {
this.offers.exp = {};
this.getOffers();
}
{{myBlah && myBlah['test']}}--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.