1

So this is kinda difficult to explain so I have a sort video of the issue with annotations

It seems like static text is not rendering (see the H3 tag). The dynamic stuff like {{ foo.bar }} and things in loops seem to work fine. It is happening to all pages as far as I can tell.

I used the AngularClass repo as a starting point.

When the page is loaded directly or refreshed (F5 etc) how it should be

When its accessed via a link from another page no static text

template file

<h3>GPS raw data</h3>
<div class="row" *ngIf="gps && gps.location">
    <div class="col-md-4">
        <strong>Time:</strong> {{ gps.location.timestamp }}
    </div>
    <div class="col-md-4">
        <strong>Latitude:</strong> {{ gps.location.latitude }}
    </div>
    <div class="col-md-4">
        <strong>Longitude:</strong> {{ gps.location.longitude }}
    </div>
</div>

There is no errors in the console.

edit

Another image to possibly clear up what the actual problem is. Note the HTML has content in the title, its hard coded. But its not displayed.

enter image description here

2
  • What is the issue. Even after watching the video ,I can't understand. Commented Oct 16, 2016 at 15:47
  • Did you have annotations on? it explains step by step in the annotations. Anyway, see the latest image I have added. Commented Oct 16, 2016 at 18:46

2 Answers 2

1

1) 1st solution, it should be *ngIf and not ng-if

<div class="row" *ngIf="gps && gps.location">                    //<<<===here
    <div class="col-md-4">
        <strong>Time:</strong> {{ gps.location.timestamp }}
    </div>
    <div class="col-md-4">
        <strong>Latitude:</strong> {{ gps.location.latitude }}
    </div>
    <div class="col-md-4">
        <strong>Longitude:</strong> {{ gps.location.longitude }}
    </div>
</div>

2) 2nd solution, don't use *ngIf and use ?. operator as shown below,

<div class="row" > 
    <div class="col-md-4" >
        <strong>Time:</strong> {{ gps?.location.timestamp }}      //<<<==here
    </div>
    <div class="col-md-4">
        <strong>Latitude:</strong> {{ gps?.location.latitude }}   //<<<==here
    </div>
    <div class="col-md-4">
        <strong>Longitude:</strong> {{ gps?.location.longitude }} //<<<==here
    </div>
</div>
Sign up to request clarification or add additional context in comments.

2 Comments

the ngIf has been changed, but that is not the problem. Please see the updated image. Its nothing to do with the template variables. Its the static text that is not showing.
damn, its working fine in firefox. Has the same buggy behaviour in chrome (what I was using) and chromium.
0

I encountered the same issue on Chrome and fixed it by removing the font-size style applied on that element. Not sure why, might be a bug of Chrome.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.