Questions tagged undefined

Explore the latest questions and answers asked by our top developers.

Angular question (Cannot read property ‘genre’ of undefined)

I’m a newbie so don’t judge me too hard. I’m trying to build a simple app similar to a tour of heroes(official angular tutorial). I faced one problem I can’t resolve as I think due to my bad understanding of fundamental programming knowledge. Here’s what I have: ngOnInit(): void { this.getMovie(); this.getSimilarMovies(); } getMovie(): any […]

By gogi15
Categorized as angular, undefined Tagged ,

TypeError: ctx.product is undefined

Help ! I’m getting the following error from my Angular (material) application: TypeError: ctx.product is undefined my service:product.service.ts @Injectable({ providedIn: ‘root’ }) export class ProductService { baseUrl = ‘http://localhost:3000/products’; constructor( private http: HttpClient, private router: Router, private snackBar: MatSnackBar) { } // Headers private httpOptions = { headers: new HttpHeaders({ ‘Content-Type’: ‘application/json’ }) }; showMessage(msg: […]

By Marcelo Freitas
Categorized as angularjs, javascript, undefined Tagged , ,

Typescript object property ‘undefined’ while it is not

I’m farly new with Typescript and struggle with what seems to be a dumb issue: I retrieve an ‘agent’ object from a service. this.agentsController.getAgent(matricule).subscribe({ next: agent => { console.log(agent) console.log(agent.emailPro) }, error: (error: string) => { console.log(error) } }); According to the 1st console.log, it is well populated : { "agent": { "matricule": "000001", "nom": […]

By Thomas L
Categorized as angularjs, typescript, undefined Tagged , ,

base 64 image undefined error when trying to perform get request with angular UI

I have a simple UI where when a user enters a name and presses a button, a get request is sent and I would like the image from that get request to be rendered in the browser. However, that image is not being rendered. Below is my UI: When the button is pressed, the following […]

By tony soprano
Categorized as angular, base64, get, image, undefined Tagged , , , ,

Undefined error coming when trying retrieve values from an Array In Angular

I have 2 models like this. export class Model { billingPlanId: number; billingPlanName: string; availablePlanBundleDetails: Array<Model2>; } export class Model2 { bundleName: string; bundlePrice: number; canvasCount: number; noOfIntegration: number; onPremNodesCount: number; onPremClusterCount: number; privateCatalogCount: number; publicClustersCount: number; publicNodesCount: number; userCount: number; } In my component i have like this. list: Model[]; getDetails() { this.service.getDetails().subscribe(res => […]

By Mands
Categorized as angular, arrays, response, undefined Tagged , , ,

Response in Angular cannot read property of undefined in API response [duplicate]

I have a Angular project where I make a call to the facebook API and get a response back. See below: FB.api(‘/me/accounts’, { access_token : given_access_token }, //the access token { fields: ‘last_name, name, email’ }, //the fields that need to be retrieved function(response) { if (!response || response.error) { console.log(‘Error’); } else { […]

typescript method returning undefined

Hey guys what am I missing here ? My method is returning undefined findUser(username: string) { this.users.forEach(element => { if(element.username == username) { console.log(element.username) //works return element.username //returning undefined } } ); } Source: Angular Questions

By iBem
Categorized as angular, return, typescript, undefined Tagged , , ,

Angular Checkbox Value to Typescript

i’m trying to make a quiz where there is a card and 4 questions. I have the 4 questions Like this <div class=”col-md-6″> <div class=”option” id=”Answer1″> <label class=”Answer1″> <input value= “Answer1″ type=”checkbox” (change) =”CheckAnswer(value)”/>{{question.answer1}} </label> </div> <div class=”option” id=”Answer2″> <label class=”Answer2″> <input value= Answer2 type=”checkbox” (change) =”CheckAnswer(value)”/>{{question.answer2}} </label> </div> <div class=”option” id=”Answer3″> <label class=”Answer3″> <input […]

By Kobe Deschuytter
Categorized as angular, css, html, typescript, undefined Tagged , , , , is undefined, when trying to use

I am working on an online forum project and i am trying to implement a way to see posts and comments, but when i go to the page for a specific post i get the following error: This is the main page where all the posts are listed And this is the page for a […]

Service data getter returning undefined in Angular

I’m having trouble finding out why my ShopManagerService keeps returning undefined when the data is accessed by a pipe. Here is the service ShopManagerService: @Injectable({ providedIn: ‘root’ }) export class ShopManagerService { private shopPreferences: ShopPreferences = null; setPreferences(shopPreferences: ShopPreferences) { this.shopPreferences = shopPreferences; } getDateFormat(){ if(this.shopPreferences == null || == null) return; return; […]

By Manuel Br s
Categorized as angular, service, typescript, undefined Tagged , , ,
1 2 3 6

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us