2

In my html I use a layout like this:

<h2>{{translation.settings}}</h2>

As you might guess, I am using a multi language setup.

Now, for some reason I am required to bind the angularjs controllers later than normal and so for a brief moment {{translation.settings}} is rendered on my page.

Obviously this is not preferable.

I have been working with knockout for a while and one way to handle such a inconvenience is to set the element's value through a html tag, e.g.:

<h2 data-bind="text: translation.settings"></h2> 

Is there a way in angularjs to set the inner element's text-value through a html-tag?

Or, since this is a possible XY problem, can I suppress the rendering of {{translation.settings}} in the <h2> element?

0

1 Answer 1

2

To prevent to show the template before it get a value use ng-cloack directive. You can use documentation here https://docs.angularjs.org/api/ng/directive/ngCloak

Sign up to request clarification or add additional context in comments.

6 Comments

Great, this seems to hide the values indeed.
@Stefan but rather you could also use ng-bind there instead of using {{}} interpolation directive
@PankajParkar: I'll have a look at that as well. I have to say, I am fairly new to angular, so can you explain why this is preferable?
@PankajParkar: ah, as I understand it ng-bind is the knockout's equivalent as I mentioned in the question. Thanks.
@Stefan look at the answer stackoverflow.com/questions/16125872/…
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.