Sony Khan
Sony Khan

Reputation: 1504

How to get text of hidden td element using angularjs?

HTML:

<td hidden ng-bind="msg.location" id="msg_location"></td>

After page loading it seems like:

<td hidden ng-bind="msg.location" id="msg_location">/2/</td>

i want to get text of td in angularjs. I tried following:

angular.element('#msg_location').html()
angular.element('#msg_location').text()
angular.element('#msg_location').innerHTML

but all of above soltions returns empty string. Can anyone help me?

thanks in advance.

Upvotes: 0

Views: 312

Answers (1)

BERGUIGA Mohamed Amine
BERGUIGA Mohamed Amine

Reputation: 6280

BECAFULL YOU USE ANGULARJS AND NOT JQUERY. So you just need to set a ng-model like bellow: html

<td hidden ng-model='msg.location' ></td>

JS

console.log('DATA IS ',$scope.msg.location);

Upvotes: 1

Related Questions