I'm Geeker
I'm Geeker

Reputation: 4637

How to get the value on load in angular js

This function in jquery

var someval = $('#someid').html();
if(someval !=""){
//something
}else{
//anything
}

How to write the same function in angularjs ?? I am a beginner in angular js. How to solve this ?? Can anyone provide me some example for this one ?

Upvotes: 1

Views: 52

Answers (2)

Jorge Guerola
Jorge Guerola

Reputation: 2082

var someval = angular.element('#someid').html();
if(someval !=""){
  //something
}else{
  //anything
}

I hope It Helps !

Upvotes: 3

V31
V31

Reputation: 7666

you can do something like this in angular:

var someval = angular.element( document.querySelector( '#someid' ) ).html();
if(someval !=""){
  //something
}else{
  //anything
}

Upvotes: 0

Related Questions