Identifying & Printing an object within an object - AngularDetecting an undefined object propertyWhat is the most efficient way to deep clone an object in JavaScript?How do I format a Microsoft JSON date?How do I remove a property from a JavaScript object?How do I check if an array includes an object in JavaScript?How can I pretty-print JSON in a shell script?How do I test for an empty JavaScript object?Checking if a key exists in a JavaScript object?How can I pretty-print JSON using JavaScript?Iterate through object properties
Is the field of q-series 'dead'?
Employer asking for online access to bank account - Is this a scam?
Why were helmets and other body armour not commonplace in the 1800s?
Compaq Portable vs IBM 5155 Portable PC
What are the real benefits of using Salesforce DX?
How did these characters "suit up" so quickly?
number headings
What is a Centaur Thief's climbing speed?
NIntegrate doesn't evaluate
Could a 19.25mm revolver actually exist?
Is DateWithin30Days(Date 1, Date 2) an Apex Method?
Caught 2 students cheating together on the final exam that I proctored
Can I tell a prospective employee that everyone in the team is leaving?
How to know if a folder is a symbolic link?
What was the idiom for something that we take without a doubt?
I know that there is a preselected candidate for a position to be filled at my department. What should I do?
A Riley Respite
Can a person survive on blood in place of water?
How to Pin Point Large File eating space in Fedora 18
Need to understand my home electrical meter to see why bill is so high and/or if neighbor is on same meter
Website returning plaintext password
Python program to find the most frequent letter in a text
How do I partition a matrx into blocks and replace zeros with dots?
Did people Unsnap to where they were?
Identifying & Printing an object within an object - Angular
Detecting an undefined object propertyWhat is the most efficient way to deep clone an object in JavaScript?How do I format a Microsoft JSON date?How do I remove a property from a JavaScript object?How do I check if an array includes an object in JavaScript?How can I pretty-print JSON in a shell script?How do I test for an empty JavaScript object?Checking if a key exists in a JavaScript object?How can I pretty-print JSON using JavaScript?Iterate through object properties
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a JSON in the following format:
key: value,
key: value,
key:
key: value,
key: value
I want to print these key values out to my page using Angular's ngIf to identify if the value is a string or another object. I tried using typeof
but it gives me an unresolved variable error in Webstorm.
How do I know that the value is an object and that I need to go in and take key values from in there?
I am using Angular 6 & Webstorm IDE.
javascript json angular typescript object
add a comment |
I have a JSON in the following format:
key: value,
key: value,
key:
key: value,
key: value
I want to print these key values out to my page using Angular's ngIf to identify if the value is a string or another object. I tried using typeof
but it gives me an unresolved variable error in Webstorm.
How do I know that the value is an object and that I need to go in and take key values from in there?
I am using Angular 6 & Webstorm IDE.
javascript json angular typescript object
add a comment |
I have a JSON in the following format:
key: value,
key: value,
key:
key: value,
key: value
I want to print these key values out to my page using Angular's ngIf to identify if the value is a string or another object. I tried using typeof
but it gives me an unresolved variable error in Webstorm.
How do I know that the value is an object and that I need to go in and take key values from in there?
I am using Angular 6 & Webstorm IDE.
javascript json angular typescript object
I have a JSON in the following format:
key: value,
key: value,
key:
key: value,
key: value
I want to print these key values out to my page using Angular's ngIf to identify if the value is a string or another object. I tried using typeof
but it gives me an unresolved variable error in Webstorm.
How do I know that the value is an object and that I need to go in and take key values from in there?
I am using Angular 6 & Webstorm IDE.
javascript json angular typescript object
javascript json angular typescript object
edited Mar 24 at 4:08
Shashank Vivek
5,88432664
5,88432664
asked Mar 24 at 3:57
Varun JoshiVarun Joshi
9310
9310
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can create a function to get that value.Take a look at this demo
In component.ts
:
checkType(data)
return typeof(data)
In html
:
<div *ngIf="checkType(data.k1) === 'string'">
I am string
</div>
add a comment |
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
);
);
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%2f55320596%2fidentifying-printing-an-object-within-an-object-angular%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
You can create a function to get that value.Take a look at this demo
In component.ts
:
checkType(data)
return typeof(data)
In html
:
<div *ngIf="checkType(data.k1) === 'string'">
I am string
</div>
add a comment |
You can create a function to get that value.Take a look at this demo
In component.ts
:
checkType(data)
return typeof(data)
In html
:
<div *ngIf="checkType(data.k1) === 'string'">
I am string
</div>
add a comment |
You can create a function to get that value.Take a look at this demo
In component.ts
:
checkType(data)
return typeof(data)
In html
:
<div *ngIf="checkType(data.k1) === 'string'">
I am string
</div>
You can create a function to get that value.Take a look at this demo
In component.ts
:
checkType(data)
return typeof(data)
In html
:
<div *ngIf="checkType(data.k1) === 'string'">
I am string
</div>
answered Mar 24 at 4:04
Shashank VivekShashank Vivek
5,88432664
5,88432664
add a comment |
add a comment |
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.
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%2f55320596%2fidentifying-printing-an-object-within-an-object-angular%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