TypeError: Cannot read property 'toUpperCase' of undefined
up vote
1
down vote
favorite
I have tried using custom pipe.This is my pipe file
import { Pipe, PipeTransform } from '@angular/core';
import { User } from 'src/app/user';
import { ApiService } from 'src/app/api.service';
import { Observable } from 'rxjs';
import { isNgTemplate } from '@angular/compiler';
import { map } from 'rxjs/operators';
@Pipe({
name: 'my-pipe'
})
export class MyPipePipe implements PipeTransform {
isEqual = false;
api: ApiService;
transform(post_id: number, users: Observable< User> ): any {
// users = this.api.getUserList();
users.subscribe(user => user.filter(userss => {
if (userss.id === post_id && post_id !== null) { this.isEqual = true; } else {
console.log(this.isEqual + ' ' + ' hataa');
}
}));
}
All i want is nonexistent users cant post.Therefore i trying user's id equalize with post's userId.Here is my html code
<div class="form-group">
<label for="userId">User Id</label>
<input type="number" class="form-control" id ="userId" name="userId" required [(ngModel)]="posts.userId">
<!--<div class="tetx text-danger" *ngIf="!isEqual" >Invalid Id!!!</div>-->
<div *ngIf=" my-pipe: posts.userId " >
Invalidd
</div>
</div>
But unfortunately I get this error:
[Angular] TypeError: Cannot read property 'toUpperCase' of undefined
angular angular6 angular-forms angular-pipe
|
show 5 more comments
up vote
1
down vote
favorite
I have tried using custom pipe.This is my pipe file
import { Pipe, PipeTransform } from '@angular/core';
import { User } from 'src/app/user';
import { ApiService } from 'src/app/api.service';
import { Observable } from 'rxjs';
import { isNgTemplate } from '@angular/compiler';
import { map } from 'rxjs/operators';
@Pipe({
name: 'my-pipe'
})
export class MyPipePipe implements PipeTransform {
isEqual = false;
api: ApiService;
transform(post_id: number, users: Observable< User> ): any {
// users = this.api.getUserList();
users.subscribe(user => user.filter(userss => {
if (userss.id === post_id && post_id !== null) { this.isEqual = true; } else {
console.log(this.isEqual + ' ' + ' hataa');
}
}));
}
All i want is nonexistent users cant post.Therefore i trying user's id equalize with post's userId.Here is my html code
<div class="form-group">
<label for="userId">User Id</label>
<input type="number" class="form-control" id ="userId" name="userId" required [(ngModel)]="posts.userId">
<!--<div class="tetx text-danger" *ngIf="!isEqual" >Invalid Id!!!</div>-->
<div *ngIf=" my-pipe: posts.userId " >
Invalidd
</div>
</div>
But unfortunately I get this error:
[Angular] TypeError: Cannot read property 'toUpperCase' of undefined
angular angular6 angular-forms angular-pipe
7
Your code has no signs of it having toUpperCase in there. Where exactly are you using it?
– SiddAjmera
Nov 19 at 10:50
<div *ngFor="let u of users_s | my-pipe " > i got error in this line
– cmyldz
Nov 19 at 10:58
Please poste your full stack trace. As text, not as image.
– trichetriche
Nov 19 at 11:04
@trichetriche i posted like this with intent to being more understandable
– cmyldz
Nov 19 at 11:14
@trichetriche but if necessary; i can poste all my code
– cmyldz
Nov 19 at 11:15
|
show 5 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have tried using custom pipe.This is my pipe file
import { Pipe, PipeTransform } from '@angular/core';
import { User } from 'src/app/user';
import { ApiService } from 'src/app/api.service';
import { Observable } from 'rxjs';
import { isNgTemplate } from '@angular/compiler';
import { map } from 'rxjs/operators';
@Pipe({
name: 'my-pipe'
})
export class MyPipePipe implements PipeTransform {
isEqual = false;
api: ApiService;
transform(post_id: number, users: Observable< User> ): any {
// users = this.api.getUserList();
users.subscribe(user => user.filter(userss => {
if (userss.id === post_id && post_id !== null) { this.isEqual = true; } else {
console.log(this.isEqual + ' ' + ' hataa');
}
}));
}
All i want is nonexistent users cant post.Therefore i trying user's id equalize with post's userId.Here is my html code
<div class="form-group">
<label for="userId">User Id</label>
<input type="number" class="form-control" id ="userId" name="userId" required [(ngModel)]="posts.userId">
<!--<div class="tetx text-danger" *ngIf="!isEqual" >Invalid Id!!!</div>-->
<div *ngIf=" my-pipe: posts.userId " >
Invalidd
</div>
</div>
But unfortunately I get this error:
[Angular] TypeError: Cannot read property 'toUpperCase' of undefined
angular angular6 angular-forms angular-pipe
I have tried using custom pipe.This is my pipe file
import { Pipe, PipeTransform } from '@angular/core';
import { User } from 'src/app/user';
import { ApiService } from 'src/app/api.service';
import { Observable } from 'rxjs';
import { isNgTemplate } from '@angular/compiler';
import { map } from 'rxjs/operators';
@Pipe({
name: 'my-pipe'
})
export class MyPipePipe implements PipeTransform {
isEqual = false;
api: ApiService;
transform(post_id: number, users: Observable< User> ): any {
// users = this.api.getUserList();
users.subscribe(user => user.filter(userss => {
if (userss.id === post_id && post_id !== null) { this.isEqual = true; } else {
console.log(this.isEqual + ' ' + ' hataa');
}
}));
}
All i want is nonexistent users cant post.Therefore i trying user's id equalize with post's userId.Here is my html code
<div class="form-group">
<label for="userId">User Id</label>
<input type="number" class="form-control" id ="userId" name="userId" required [(ngModel)]="posts.userId">
<!--<div class="tetx text-danger" *ngIf="!isEqual" >Invalid Id!!!</div>-->
<div *ngIf=" my-pipe: posts.userId " >
Invalidd
</div>
</div>
But unfortunately I get this error:
[Angular] TypeError: Cannot read property 'toUpperCase' of undefined
angular angular6 angular-forms angular-pipe
angular angular6 angular-forms angular-pipe
edited Nov 19 at 11:56
Uwe Keim
27.3k30128210
27.3k30128210
asked Nov 19 at 10:48
cmyldz
64
64
7
Your code has no signs of it having toUpperCase in there. Where exactly are you using it?
– SiddAjmera
Nov 19 at 10:50
<div *ngFor="let u of users_s | my-pipe " > i got error in this line
– cmyldz
Nov 19 at 10:58
Please poste your full stack trace. As text, not as image.
– trichetriche
Nov 19 at 11:04
@trichetriche i posted like this with intent to being more understandable
– cmyldz
Nov 19 at 11:14
@trichetriche but if necessary; i can poste all my code
– cmyldz
Nov 19 at 11:15
|
show 5 more comments
7
Your code has no signs of it having toUpperCase in there. Where exactly are you using it?
– SiddAjmera
Nov 19 at 10:50
<div *ngFor="let u of users_s | my-pipe " > i got error in this line
– cmyldz
Nov 19 at 10:58
Please poste your full stack trace. As text, not as image.
– trichetriche
Nov 19 at 11:04
@trichetriche i posted like this with intent to being more understandable
– cmyldz
Nov 19 at 11:14
@trichetriche but if necessary; i can poste all my code
– cmyldz
Nov 19 at 11:15
7
7
Your code has no signs of it having toUpperCase in there. Where exactly are you using it?
– SiddAjmera
Nov 19 at 10:50
Your code has no signs of it having toUpperCase in there. Where exactly are you using it?
– SiddAjmera
Nov 19 at 10:50
<div *ngFor="let u of users_s | my-pipe " > i got error in this line
– cmyldz
Nov 19 at 10:58
<div *ngFor="let u of users_s | my-pipe " > i got error in this line
– cmyldz
Nov 19 at 10:58
Please poste your full stack trace. As text, not as image.
– trichetriche
Nov 19 at 11:04
Please poste your full stack trace. As text, not as image.
– trichetriche
Nov 19 at 11:04
@trichetriche i posted like this with intent to being more understandable
– cmyldz
Nov 19 at 11:14
@trichetriche i posted like this with intent to being more understandable
– cmyldz
Nov 19 at 11:14
@trichetriche but if necessary; i can poste all my code
– cmyldz
Nov 19 at 11:15
@trichetriche but if necessary; i can poste all my code
– cmyldz
Nov 19 at 11:15
|
show 5 more comments
1 Answer
1
active
oldest
votes
up vote
1
down vote
The error comes from Angular compiler that tries to compile your template.
Choose another name for your pipe, i.e. myPipe
:
@Pipe({
name: 'myPipe'
...
*ngFor="let u of users_s | myPipe"
And you can't use pipe without passing value to it:
*ngIf=" my-pipe: posts.userId "
it should be something:
*ngIf="postId | myPipe"
I got this error >> [Angular] Identifier 'myPipe' is not defined. The component declaration, template variable declarations, and element references do not contain such a member
– cmyldz
Nov 19 at 11:56
@Pipe({ name: 'myPipe'
– yurzui
Nov 19 at 11:57
Yes ; I changed like you said
– cmyldz
Nov 19 at 11:58
Is it Angular language service error? Try to reopen your editor. Do you have any runtime errors?
– yurzui
Nov 19 at 11:59
red line appears under the myPipe
– cmyldz
Nov 19 at 12:08
|
show 5 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
The error comes from Angular compiler that tries to compile your template.
Choose another name for your pipe, i.e. myPipe
:
@Pipe({
name: 'myPipe'
...
*ngFor="let u of users_s | myPipe"
And you can't use pipe without passing value to it:
*ngIf=" my-pipe: posts.userId "
it should be something:
*ngIf="postId | myPipe"
I got this error >> [Angular] Identifier 'myPipe' is not defined. The component declaration, template variable declarations, and element references do not contain such a member
– cmyldz
Nov 19 at 11:56
@Pipe({ name: 'myPipe'
– yurzui
Nov 19 at 11:57
Yes ; I changed like you said
– cmyldz
Nov 19 at 11:58
Is it Angular language service error? Try to reopen your editor. Do you have any runtime errors?
– yurzui
Nov 19 at 11:59
red line appears under the myPipe
– cmyldz
Nov 19 at 12:08
|
show 5 more comments
up vote
1
down vote
The error comes from Angular compiler that tries to compile your template.
Choose another name for your pipe, i.e. myPipe
:
@Pipe({
name: 'myPipe'
...
*ngFor="let u of users_s | myPipe"
And you can't use pipe without passing value to it:
*ngIf=" my-pipe: posts.userId "
it should be something:
*ngIf="postId | myPipe"
I got this error >> [Angular] Identifier 'myPipe' is not defined. The component declaration, template variable declarations, and element references do not contain such a member
– cmyldz
Nov 19 at 11:56
@Pipe({ name: 'myPipe'
– yurzui
Nov 19 at 11:57
Yes ; I changed like you said
– cmyldz
Nov 19 at 11:58
Is it Angular language service error? Try to reopen your editor. Do you have any runtime errors?
– yurzui
Nov 19 at 11:59
red line appears under the myPipe
– cmyldz
Nov 19 at 12:08
|
show 5 more comments
up vote
1
down vote
up vote
1
down vote
The error comes from Angular compiler that tries to compile your template.
Choose another name for your pipe, i.e. myPipe
:
@Pipe({
name: 'myPipe'
...
*ngFor="let u of users_s | myPipe"
And you can't use pipe without passing value to it:
*ngIf=" my-pipe: posts.userId "
it should be something:
*ngIf="postId | myPipe"
The error comes from Angular compiler that tries to compile your template.
Choose another name for your pipe, i.e. myPipe
:
@Pipe({
name: 'myPipe'
...
*ngFor="let u of users_s | myPipe"
And you can't use pipe without passing value to it:
*ngIf=" my-pipe: posts.userId "
it should be something:
*ngIf="postId | myPipe"
edited Nov 19 at 12:11
answered Nov 19 at 11:52
yurzui
91.8k10180204
91.8k10180204
I got this error >> [Angular] Identifier 'myPipe' is not defined. The component declaration, template variable declarations, and element references do not contain such a member
– cmyldz
Nov 19 at 11:56
@Pipe({ name: 'myPipe'
– yurzui
Nov 19 at 11:57
Yes ; I changed like you said
– cmyldz
Nov 19 at 11:58
Is it Angular language service error? Try to reopen your editor. Do you have any runtime errors?
– yurzui
Nov 19 at 11:59
red line appears under the myPipe
– cmyldz
Nov 19 at 12:08
|
show 5 more comments
I got this error >> [Angular] Identifier 'myPipe' is not defined. The component declaration, template variable declarations, and element references do not contain such a member
– cmyldz
Nov 19 at 11:56
@Pipe({ name: 'myPipe'
– yurzui
Nov 19 at 11:57
Yes ; I changed like you said
– cmyldz
Nov 19 at 11:58
Is it Angular language service error? Try to reopen your editor. Do you have any runtime errors?
– yurzui
Nov 19 at 11:59
red line appears under the myPipe
– cmyldz
Nov 19 at 12:08
I got this error >> [Angular] Identifier 'myPipe' is not defined. The component declaration, template variable declarations, and element references do not contain such a member
– cmyldz
Nov 19 at 11:56
I got this error >> [Angular] Identifier 'myPipe' is not defined. The component declaration, template variable declarations, and element references do not contain such a member
– cmyldz
Nov 19 at 11:56
@Pipe({ name: 'myPipe'
– yurzui
Nov 19 at 11:57
@Pipe({ name: 'myPipe'
– yurzui
Nov 19 at 11:57
Yes ; I changed like you said
– cmyldz
Nov 19 at 11:58
Yes ; I changed like you said
– cmyldz
Nov 19 at 11:58
Is it Angular language service error? Try to reopen your editor. Do you have any runtime errors?
– yurzui
Nov 19 at 11:59
Is it Angular language service error? Try to reopen your editor. Do you have any runtime errors?
– yurzui
Nov 19 at 11:59
red line appears under the myPipe
– cmyldz
Nov 19 at 12:08
red line appears under the myPipe
– cmyldz
Nov 19 at 12:08
|
show 5 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372987%2ftypeerror-cannot-read-property-touppercase-of-undefined%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
7
Your code has no signs of it having toUpperCase in there. Where exactly are you using it?
– SiddAjmera
Nov 19 at 10:50
<div *ngFor="let u of users_s | my-pipe " > i got error in this line
– cmyldz
Nov 19 at 10:58
Please poste your full stack trace. As text, not as image.
– trichetriche
Nov 19 at 11:04
@trichetriche i posted like this with intent to being more understandable
– cmyldz
Nov 19 at 11:14
@trichetriche but if necessary; i can poste all my code
– cmyldz
Nov 19 at 11:15