converting strings to number from json response - *ngFor - Angular 6Convert json string value to numberSafely turning a JSON string into an object.NET - JSON serialization of enum as stringWhy does Google prepend while(1); to their JSON responses?Why can't Python parse this JSON data?Returning JSON from a PHP ScriptConvert JS object to JSON stringHow do I turn a C# object into a JSON string in .NET?How do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?Standard JSON API response format?Huge number of files generated for every Angular project

Why do we use polarized capacitors?

"My colleague's body is amazing"

I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine

Extreme, but not acceptable situation and I can't start the work tomorrow morning

Email Account under attack (really) - anything I can do?

Prime joint compound before latex paint?

What does "enim et" mean?

What is the offset in a seaplane's hull?

Is it wise to focus on putting odd beats on left when playing double bass drums?

Should the British be getting ready for a no-deal Brexit?

Where else does the Shulchan Aruch quote an authority by name?

Why doesn't a const reference extend the life of a temporary object passed via a function?

Was there ever an axiom rendered a theorem?

Does the average primeness of natural numbers tend to zero?

Ideas for 3rd eye abilities

How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)

New order #4: World

COUNT(*) or MAX(id) - which is faster?

What to wear for invited talk in Canada

extract characters between two commas?

Pristine Bit Checking

Where to refill my bottle in India?

How to answer pointed "are you quitting" questioning when I don't want them to suspect

aging parents with no investments



converting strings to number from json response - *ngFor - Angular 6


Convert json string value to numberSafely turning a JSON string into an object.NET - JSON serialization of enum as stringWhy does Google prepend while(1); to their JSON responses?Why can't Python parse this JSON data?Returning JSON from a PHP ScriptConvert JS object to JSON stringHow do I turn a C# object into a JSON string in .NET?How do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?Standard JSON API response format?Huge number of files generated for every Angular project






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Am trying to converting some strings from json response to number. for example



zipcode: "92998-3874" to 92998-3874. came across this SO. but don't where its getting failed. followed by that i need to loop it in my view but am facing below error in stack blitz console.



ERROR
Error: Cannot find a differ supporting object '[object Object]' of type 'Clementina DuBuque'. NgFor only supports binding to Iterables such as Arrays.
Unable to display error. Open your browser's console to view.


so far:



export class AppComponent 
name = 'Angular';
private _userList = [];
private _userListAddress:any = [];
_sampleURL = 'https://jsonplaceholder.typicode.com/users';

constructor(private _http: HttpClient)
_loadData()
this._http.get<any[]>(this._sampleURL).subscribe(data =>
this._userList = data;
this._userListAddress = data[0].address.suite;
console.log(this._userList);

for (var _address in this._userList)
this._userListAddress = this._userList[_address];
console.log('address',
parseInt(this._userListAddress.address.zipcode));

/*

//below snippet is used to convert strings to num

[].forEach.call(this._userList, function (a, b)
[].forEach.call(Object.keys(a), function (c)
if (!isNaN(this._userList[b][c]))
this._userList[b][c] = +this._userList[b][c];
);
);
console.log(this._userList); */


)




<button (click)="_loadData()">Load data</button>

<div *ngFor="let list of _userList">
<ul>
<li>list.address.zipcode</li>
</ul>

<div *ngFor="let addresList of _userListAddress">
<ul>
<li>addresList.address.zipcode</li>
</ul>
</div>
</div>


where am doing wrong or suggest better way to achieve this.
Helps much appreciated.



Stack Blitz










share|improve this question



















  • 1





    Can you produce the link of the stackblitz that you have worked??

    – Maniraj from Karur
    Mar 8 at 7:21











  • @ManirajfromKarur i've updated pls check the link

    – worstCoder
    Mar 8 at 7:25






  • 1





    1) Why do you want to convert string to number? 2) Do you realise that this would cause the expression and the result will be a subtraction

    – Sergey
    Mar 8 at 7:28











  • Is that what you want? stackblitz.com/edit/angular-bjs4qh?file=src/app/…

    – Sergey
    Mar 8 at 7:32











  • i've to start some other requirement. for that i need to convert this from string to number then only i can come the conclusion whether the other pending requirement is feasible or not. that's why. i've to implement contentEditable concept in my roadmap

    – worstCoder
    Mar 8 at 7:33

















0















Am trying to converting some strings from json response to number. for example



zipcode: "92998-3874" to 92998-3874. came across this SO. but don't where its getting failed. followed by that i need to loop it in my view but am facing below error in stack blitz console.



ERROR
Error: Cannot find a differ supporting object '[object Object]' of type 'Clementina DuBuque'. NgFor only supports binding to Iterables such as Arrays.
Unable to display error. Open your browser's console to view.


so far:



export class AppComponent 
name = 'Angular';
private _userList = [];
private _userListAddress:any = [];
_sampleURL = 'https://jsonplaceholder.typicode.com/users';

constructor(private _http: HttpClient)
_loadData()
this._http.get<any[]>(this._sampleURL).subscribe(data =>
this._userList = data;
this._userListAddress = data[0].address.suite;
console.log(this._userList);

for (var _address in this._userList)
this._userListAddress = this._userList[_address];
console.log('address',
parseInt(this._userListAddress.address.zipcode));

/*

//below snippet is used to convert strings to num

[].forEach.call(this._userList, function (a, b)
[].forEach.call(Object.keys(a), function (c)
if (!isNaN(this._userList[b][c]))
this._userList[b][c] = +this._userList[b][c];
);
);
console.log(this._userList); */


)




<button (click)="_loadData()">Load data</button>

<div *ngFor="let list of _userList">
<ul>
<li>list.address.zipcode</li>
</ul>

<div *ngFor="let addresList of _userListAddress">
<ul>
<li>addresList.address.zipcode</li>
</ul>
</div>
</div>


where am doing wrong or suggest better way to achieve this.
Helps much appreciated.



Stack Blitz










share|improve this question



















  • 1





    Can you produce the link of the stackblitz that you have worked??

    – Maniraj from Karur
    Mar 8 at 7:21











  • @ManirajfromKarur i've updated pls check the link

    – worstCoder
    Mar 8 at 7:25






  • 1





    1) Why do you want to convert string to number? 2) Do you realise that this would cause the expression and the result will be a subtraction

    – Sergey
    Mar 8 at 7:28











  • Is that what you want? stackblitz.com/edit/angular-bjs4qh?file=src/app/…

    – Sergey
    Mar 8 at 7:32











  • i've to start some other requirement. for that i need to convert this from string to number then only i can come the conclusion whether the other pending requirement is feasible or not. that's why. i've to implement contentEditable concept in my roadmap

    – worstCoder
    Mar 8 at 7:33













0












0








0








Am trying to converting some strings from json response to number. for example



zipcode: "92998-3874" to 92998-3874. came across this SO. but don't where its getting failed. followed by that i need to loop it in my view but am facing below error in stack blitz console.



ERROR
Error: Cannot find a differ supporting object '[object Object]' of type 'Clementina DuBuque'. NgFor only supports binding to Iterables such as Arrays.
Unable to display error. Open your browser's console to view.


so far:



export class AppComponent 
name = 'Angular';
private _userList = [];
private _userListAddress:any = [];
_sampleURL = 'https://jsonplaceholder.typicode.com/users';

constructor(private _http: HttpClient)
_loadData()
this._http.get<any[]>(this._sampleURL).subscribe(data =>
this._userList = data;
this._userListAddress = data[0].address.suite;
console.log(this._userList);

for (var _address in this._userList)
this._userListAddress = this._userList[_address];
console.log('address',
parseInt(this._userListAddress.address.zipcode));

/*

//below snippet is used to convert strings to num

[].forEach.call(this._userList, function (a, b)
[].forEach.call(Object.keys(a), function (c)
if (!isNaN(this._userList[b][c]))
this._userList[b][c] = +this._userList[b][c];
);
);
console.log(this._userList); */


)




<button (click)="_loadData()">Load data</button>

<div *ngFor="let list of _userList">
<ul>
<li>list.address.zipcode</li>
</ul>

<div *ngFor="let addresList of _userListAddress">
<ul>
<li>addresList.address.zipcode</li>
</ul>
</div>
</div>


where am doing wrong or suggest better way to achieve this.
Helps much appreciated.



Stack Blitz










share|improve this question
















Am trying to converting some strings from json response to number. for example



zipcode: "92998-3874" to 92998-3874. came across this SO. but don't where its getting failed. followed by that i need to loop it in my view but am facing below error in stack blitz console.



ERROR
Error: Cannot find a differ supporting object '[object Object]' of type 'Clementina DuBuque'. NgFor only supports binding to Iterables such as Arrays.
Unable to display error. Open your browser's console to view.


so far:



export class AppComponent 
name = 'Angular';
private _userList = [];
private _userListAddress:any = [];
_sampleURL = 'https://jsonplaceholder.typicode.com/users';

constructor(private _http: HttpClient)
_loadData()
this._http.get<any[]>(this._sampleURL).subscribe(data =>
this._userList = data;
this._userListAddress = data[0].address.suite;
console.log(this._userList);

for (var _address in this._userList)
this._userListAddress = this._userList[_address];
console.log('address',
parseInt(this._userListAddress.address.zipcode));

/*

//below snippet is used to convert strings to num

[].forEach.call(this._userList, function (a, b)
[].forEach.call(Object.keys(a), function (c)
if (!isNaN(this._userList[b][c]))
this._userList[b][c] = +this._userList[b][c];
);
);
console.log(this._userList); */


)




<button (click)="_loadData()">Load data</button>

<div *ngFor="let list of _userList">
<ul>
<li>list.address.zipcode</li>
</ul>

<div *ngFor="let addresList of _userListAddress">
<ul>
<li>addresList.address.zipcode</li>
</ul>
</div>
</div>


where am doing wrong or suggest better way to achieve this.
Helps much appreciated.



Stack Blitz







json angular loops angular6






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 7:25







worstCoder

















asked Mar 8 at 7:16









worstCoderworstCoder

139113




139113







  • 1





    Can you produce the link of the stackblitz that you have worked??

    – Maniraj from Karur
    Mar 8 at 7:21











  • @ManirajfromKarur i've updated pls check the link

    – worstCoder
    Mar 8 at 7:25






  • 1





    1) Why do you want to convert string to number? 2) Do you realise that this would cause the expression and the result will be a subtraction

    – Sergey
    Mar 8 at 7:28











  • Is that what you want? stackblitz.com/edit/angular-bjs4qh?file=src/app/…

    – Sergey
    Mar 8 at 7:32











  • i've to start some other requirement. for that i need to convert this from string to number then only i can come the conclusion whether the other pending requirement is feasible or not. that's why. i've to implement contentEditable concept in my roadmap

    – worstCoder
    Mar 8 at 7:33












  • 1





    Can you produce the link of the stackblitz that you have worked??

    – Maniraj from Karur
    Mar 8 at 7:21











  • @ManirajfromKarur i've updated pls check the link

    – worstCoder
    Mar 8 at 7:25






  • 1





    1) Why do you want to convert string to number? 2) Do you realise that this would cause the expression and the result will be a subtraction

    – Sergey
    Mar 8 at 7:28











  • Is that what you want? stackblitz.com/edit/angular-bjs4qh?file=src/app/…

    – Sergey
    Mar 8 at 7:32











  • i've to start some other requirement. for that i need to convert this from string to number then only i can come the conclusion whether the other pending requirement is feasible or not. that's why. i've to implement contentEditable concept in my roadmap

    – worstCoder
    Mar 8 at 7:33







1




1





Can you produce the link of the stackblitz that you have worked??

– Maniraj from Karur
Mar 8 at 7:21





Can you produce the link of the stackblitz that you have worked??

– Maniraj from Karur
Mar 8 at 7:21













@ManirajfromKarur i've updated pls check the link

– worstCoder
Mar 8 at 7:25





@ManirajfromKarur i've updated pls check the link

– worstCoder
Mar 8 at 7:25




1




1





1) Why do you want to convert string to number? 2) Do you realise that this would cause the expression and the result will be a subtraction

– Sergey
Mar 8 at 7:28





1) Why do you want to convert string to number? 2) Do you realise that this would cause the expression and the result will be a subtraction

– Sergey
Mar 8 at 7:28













Is that what you want? stackblitz.com/edit/angular-bjs4qh?file=src/app/…

– Sergey
Mar 8 at 7:32





Is that what you want? stackblitz.com/edit/angular-bjs4qh?file=src/app/…

– Sergey
Mar 8 at 7:32













i've to start some other requirement. for that i need to convert this from string to number then only i can come the conclusion whether the other pending requirement is feasible or not. that's why. i've to implement contentEditable concept in my roadmap

– worstCoder
Mar 8 at 7:33





i've to start some other requirement. for that i need to convert this from string to number then only i can come the conclusion whether the other pending requirement is feasible or not. that's why. i've to implement contentEditable concept in my roadmap

– worstCoder
Mar 8 at 7:33












1 Answer
1






active

oldest

votes


















1














If we are talking about that issue :



ERROR
Error: Cannot find a differ supporting object '[object Object]' of type 'Clementina DuBuque'. NgFor only supports binding to Iterables such as Arrays.
Unable to display error. Open your browser's console to view.


It's here :



for (var _address in this._userList) {


_address - is an user-object here like



"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address":
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo":
"lat": "-37.3159",
"lng": "81.1496"

,
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company":
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"



and then you are trying to get user-object from the array of users bypassing user-object as a key which is wrong actually.
this._userListAddress = this._userList[_address];



So it's not a conversation issue, just check the flow of your code.




Update




Just replace the special character and then parse:






// ES6
let stringNumber = '123456-123';
let convertedNumber = Number(stringNumber.replace('-',''));
console.log(convertedNumber);
// pure js
let anotherStringNumber = '123456-123';
let anotherConvertedNumber = parseInt(anotherStringNumber.replace('-',''));
console.log(anotherConvertedNumber);








share|improve this answer

























  • yes you're absolutely right. flow only wrong. but am looking for the way to convert that string value into number then have to loop in my view.. any idea?

    – worstCoder
    Mar 8 at 8:25






  • 2





    if you want to convert '####-###' to number its possible, but the result would be '#######' - cuz numbers can't contain special characters except decimal or thousand separators like (',' and '.')

    – un.spike
    Mar 8 at 9:06












  • yeah that also fine.

    – worstCoder
    Mar 8 at 9:07






  • 2





    Number("123123-123123".replace('-','')) or parceInt("123123-123123".replace('-',''))

    – un.spike
    Mar 8 at 9:11











  • @worstCoder is it applicable on your case?

    – un.spike
    Mar 12 at 16:26











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058451%2fconverting-strings-to-number-from-json-response-ngfor-angular-6%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














If we are talking about that issue :



ERROR
Error: Cannot find a differ supporting object '[object Object]' of type 'Clementina DuBuque'. NgFor only supports binding to Iterables such as Arrays.
Unable to display error. Open your browser's console to view.


It's here :



for (var _address in this._userList) {


_address - is an user-object here like



"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address":
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo":
"lat": "-37.3159",
"lng": "81.1496"

,
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company":
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"



and then you are trying to get user-object from the array of users bypassing user-object as a key which is wrong actually.
this._userListAddress = this._userList[_address];



So it's not a conversation issue, just check the flow of your code.




Update




Just replace the special character and then parse:






// ES6
let stringNumber = '123456-123';
let convertedNumber = Number(stringNumber.replace('-',''));
console.log(convertedNumber);
// pure js
let anotherStringNumber = '123456-123';
let anotherConvertedNumber = parseInt(anotherStringNumber.replace('-',''));
console.log(anotherConvertedNumber);








share|improve this answer

























  • yes you're absolutely right. flow only wrong. but am looking for the way to convert that string value into number then have to loop in my view.. any idea?

    – worstCoder
    Mar 8 at 8:25






  • 2





    if you want to convert '####-###' to number its possible, but the result would be '#######' - cuz numbers can't contain special characters except decimal or thousand separators like (',' and '.')

    – un.spike
    Mar 8 at 9:06












  • yeah that also fine.

    – worstCoder
    Mar 8 at 9:07






  • 2





    Number("123123-123123".replace('-','')) or parceInt("123123-123123".replace('-',''))

    – un.spike
    Mar 8 at 9:11











  • @worstCoder is it applicable on your case?

    – un.spike
    Mar 12 at 16:26















1














If we are talking about that issue :



ERROR
Error: Cannot find a differ supporting object '[object Object]' of type 'Clementina DuBuque'. NgFor only supports binding to Iterables such as Arrays.
Unable to display error. Open your browser's console to view.


It's here :



for (var _address in this._userList) {


_address - is an user-object here like



"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address":
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo":
"lat": "-37.3159",
"lng": "81.1496"

,
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company":
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"



and then you are trying to get user-object from the array of users bypassing user-object as a key which is wrong actually.
this._userListAddress = this._userList[_address];



So it's not a conversation issue, just check the flow of your code.




Update




Just replace the special character and then parse:






// ES6
let stringNumber = '123456-123';
let convertedNumber = Number(stringNumber.replace('-',''));
console.log(convertedNumber);
// pure js
let anotherStringNumber = '123456-123';
let anotherConvertedNumber = parseInt(anotherStringNumber.replace('-',''));
console.log(anotherConvertedNumber);








share|improve this answer

























  • yes you're absolutely right. flow only wrong. but am looking for the way to convert that string value into number then have to loop in my view.. any idea?

    – worstCoder
    Mar 8 at 8:25






  • 2





    if you want to convert '####-###' to number its possible, but the result would be '#######' - cuz numbers can't contain special characters except decimal or thousand separators like (',' and '.')

    – un.spike
    Mar 8 at 9:06












  • yeah that also fine.

    – worstCoder
    Mar 8 at 9:07






  • 2





    Number("123123-123123".replace('-','')) or parceInt("123123-123123".replace('-',''))

    – un.spike
    Mar 8 at 9:11











  • @worstCoder is it applicable on your case?

    – un.spike
    Mar 12 at 16:26













1












1








1







If we are talking about that issue :



ERROR
Error: Cannot find a differ supporting object '[object Object]' of type 'Clementina DuBuque'. NgFor only supports binding to Iterables such as Arrays.
Unable to display error. Open your browser's console to view.


It's here :



for (var _address in this._userList) {


_address - is an user-object here like



"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address":
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo":
"lat": "-37.3159",
"lng": "81.1496"

,
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company":
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"



and then you are trying to get user-object from the array of users bypassing user-object as a key which is wrong actually.
this._userListAddress = this._userList[_address];



So it's not a conversation issue, just check the flow of your code.




Update




Just replace the special character and then parse:






// ES6
let stringNumber = '123456-123';
let convertedNumber = Number(stringNumber.replace('-',''));
console.log(convertedNumber);
// pure js
let anotherStringNumber = '123456-123';
let anotherConvertedNumber = parseInt(anotherStringNumber.replace('-',''));
console.log(anotherConvertedNumber);








share|improve this answer















If we are talking about that issue :



ERROR
Error: Cannot find a differ supporting object '[object Object]' of type 'Clementina DuBuque'. NgFor only supports binding to Iterables such as Arrays.
Unable to display error. Open your browser's console to view.


It's here :



for (var _address in this._userList) {


_address - is an user-object here like



"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address":
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo":
"lat": "-37.3159",
"lng": "81.1496"

,
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company":
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"



and then you are trying to get user-object from the array of users bypassing user-object as a key which is wrong actually.
this._userListAddress = this._userList[_address];



So it's not a conversation issue, just check the flow of your code.




Update




Just replace the special character and then parse:






// ES6
let stringNumber = '123456-123';
let convertedNumber = Number(stringNumber.replace('-',''));
console.log(convertedNumber);
// pure js
let anotherStringNumber = '123456-123';
let anotherConvertedNumber = parseInt(anotherStringNumber.replace('-',''));
console.log(anotherConvertedNumber);








// ES6
let stringNumber = '123456-123';
let convertedNumber = Number(stringNumber.replace('-',''));
console.log(convertedNumber);
// pure js
let anotherStringNumber = '123456-123';
let anotherConvertedNumber = parseInt(anotherStringNumber.replace('-',''));
console.log(anotherConvertedNumber);





// ES6
let stringNumber = '123456-123';
let convertedNumber = Number(stringNumber.replace('-',''));
console.log(convertedNumber);
// pure js
let anotherStringNumber = '123456-123';
let anotherConvertedNumber = parseInt(anotherStringNumber.replace('-',''));
console.log(anotherConvertedNumber);






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 8 at 9:32

























answered Mar 8 at 7:38









un.spikeun.spike

1,7831818




1,7831818












  • yes you're absolutely right. flow only wrong. but am looking for the way to convert that string value into number then have to loop in my view.. any idea?

    – worstCoder
    Mar 8 at 8:25






  • 2





    if you want to convert '####-###' to number its possible, but the result would be '#######' - cuz numbers can't contain special characters except decimal or thousand separators like (',' and '.')

    – un.spike
    Mar 8 at 9:06












  • yeah that also fine.

    – worstCoder
    Mar 8 at 9:07






  • 2





    Number("123123-123123".replace('-','')) or parceInt("123123-123123".replace('-',''))

    – un.spike
    Mar 8 at 9:11











  • @worstCoder is it applicable on your case?

    – un.spike
    Mar 12 at 16:26

















  • yes you're absolutely right. flow only wrong. but am looking for the way to convert that string value into number then have to loop in my view.. any idea?

    – worstCoder
    Mar 8 at 8:25






  • 2





    if you want to convert '####-###' to number its possible, but the result would be '#######' - cuz numbers can't contain special characters except decimal or thousand separators like (',' and '.')

    – un.spike
    Mar 8 at 9:06












  • yeah that also fine.

    – worstCoder
    Mar 8 at 9:07






  • 2





    Number("123123-123123".replace('-','')) or parceInt("123123-123123".replace('-',''))

    – un.spike
    Mar 8 at 9:11











  • @worstCoder is it applicable on your case?

    – un.spike
    Mar 12 at 16:26
















yes you're absolutely right. flow only wrong. but am looking for the way to convert that string value into number then have to loop in my view.. any idea?

– worstCoder
Mar 8 at 8:25





yes you're absolutely right. flow only wrong. but am looking for the way to convert that string value into number then have to loop in my view.. any idea?

– worstCoder
Mar 8 at 8:25




2




2





if you want to convert '####-###' to number its possible, but the result would be '#######' - cuz numbers can't contain special characters except decimal or thousand separators like (',' and '.')

– un.spike
Mar 8 at 9:06






if you want to convert '####-###' to number its possible, but the result would be '#######' - cuz numbers can't contain special characters except decimal or thousand separators like (',' and '.')

– un.spike
Mar 8 at 9:06














yeah that also fine.

– worstCoder
Mar 8 at 9:07





yeah that also fine.

– worstCoder
Mar 8 at 9:07




2




2





Number("123123-123123".replace('-','')) or parceInt("123123-123123".replace('-',''))

– un.spike
Mar 8 at 9:11





Number("123123-123123".replace('-','')) or parceInt("123123-123123".replace('-',''))

– un.spike
Mar 8 at 9:11













@worstCoder is it applicable on your case?

– un.spike
Mar 12 at 16:26





@worstCoder is it applicable on your case?

– un.spike
Mar 12 at 16:26



















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058451%2fconverting-strings-to-number-from-json-response-ngfor-angular-6%23new-answer', 'question_page');

);

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







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко