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;








1















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.










share|improve this question






























    1















    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.










    share|improve this question


























      1












      1








      1








      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.










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 24 at 4:08









      Shashank Vivek

      5,88432664




      5,88432664










      asked Mar 24 at 3:57









      Varun JoshiVarun Joshi

      9310




      9310






















          1 Answer
          1






          active

          oldest

          votes


















          1














          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>





          share|improve this answer























            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%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









            1














            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>





            share|improve this answer



























              1














              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>





              share|improve this answer

























                1












                1








                1







                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>





                share|improve this answer













                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>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 24 at 4:04









                Shashank VivekShashank Vivek

                5,88432664




                5,88432664





























                    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%2f55320596%2fidentifying-printing-an-object-within-an-object-angular%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

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript