Questions tagged [ng-bind]

The ngBind attribute tells Angular to replace the text content of the specified HTML element with the value of a given expression, and to update the text content when the value of that expression changes. Typically, you don't use ngBind directly, but instead you use the double curly markup like {{ expression }} which is similar but less verbose.

Source: http://docs.angularjs.org/api/ng.directive:ngBind

The ngBind attribute tells Angular to replace the text content of the specified HTML element with the value of a given expression, and to update the text content when the value of that expression changes.

Typically, you don't use ngBind directly, but instead you use the double curly markup like {{ expression }} which is similar but less verbose.

It is preferrable to use ngBind instead of {{ expression }} when a template is momentarily displayed by the browser in its raw state before Angular compiles it. Since ngBind is an element attribute, it makes the bindings invisible to the user while the page is loading.

An alternative solution to this problem would be using the ngCloak directive.

Usage

as attribute

<ANY ng-bind="{expression}">
   ...
</ANY>

as class

<ANY class="ng-bind: {expression};">
   ...
</ANY>
  • Parameters

    ngBind – {expression} – Expression to evaluate.

183 questions
6
votes
4 answers

how to limit character number in ng-bind-html in AngularJS?

How can I limit number of characters for ng-bind-html result in angularJS? Is it possible? For example there is some text in js file and with $sce and ng-bind-html transform to html. I want to show som... How can I limit it?
m hadadi
  • 949
  • 2
  • 10
  • 22
6
votes
1 answer

AngularJS ng-bind needs to show variable + "string"

I've created an ng-bind element in my template, which displays a number rounded by one decimal. How do I add a % to the end of it, from within the ng-bind logic? My code:
Jeffrey Roosendaal
  • 6,872
  • 8
  • 37
  • 55
5
votes
2 answers

Angularjs: server side (php) rendering and data binding client side after an event

The backend delivers a fully rendered site and on the frontend I want for angularjs to handle the dynamic content through ajax-call /data binding but if you deliver the directive ng-bind then angularjs binds them directly to their initial value…
mexican_75
  • 147
  • 2
  • 7
5
votes
2 answers

dateTime-local does not bind properly

I am trying to bind an attribute of my model to a dateTime-local input and something is not working properly. This is my model $scope.testDate = new Date($.now()); This is my html
user860067
  • 121
  • 1
  • 4
4
votes
1 answer

How to update DOM when value changes in controller

I have a function getData which just increments value of var counter. Whenever an increment takes place, I want angular to automatically update that inside a div I've tried ng-bind but it only works if I click on a form…
Stacy J
  • 2,721
  • 15
  • 58
  • 92
4
votes
2 answers

Why AngularJS ng-bind does not update the view

Why this little angular module can't update the view when the ng-bind property is changed?