I am using angular in my app and text appears for a second as this {{user.name}}, people told me to use ng-model, so am using <span ng-model="user.name"></span>
but it's not showing anything. What should I do? Note: Beginner here.
Asked
Active
Viewed 66 times
-1

Brittany Rutherford
- 555
- 1
- 5
- 15
-
For people marking the question as duplicate, please provide helpful thing instead, redirect me to the question where you say it's duplicate. Thank you – Brittany Rutherford Sep 01 '15 at 21:42
-
1`ng-model` or `ng-value` on input field, `ng-bind` on span/div tags – YOU Sep 02 '15 at 02:03
1 Answers
0
The span element is readonly. You need an input type for two-way binding, which is what the ng-model directive is providing you.
Instead, you can utilize the ng-cloak directive to hide the content prior to the template compiling.
Example:
<span ng-cloak>{{user.name}}</span>

Michael G
- 6,695
- 2
- 41
- 59
-
-
I have to use this CSS class mentioned in this page: https://docs.angularjs.org/api/ng/directive/ngCloak ??? – Brittany Rutherford Sep 01 '15 at 21:46
-
There is also a recommendation to use class="ng-cloak" .. what's the difference? And do I have to do css to hide it? – Brittany Rutherford Sep 01 '15 at 21:51