1

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 ?

2 Answers 2

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

I hope It Helps !

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

2 Comments

how to write the $('#someid').hide(); in angular js ??
in this case you need to use ng-hide=""! HTML: ng-show="hideNow" CONTROLLER: $scope.hideNow = true; //put false for show Check that docs.angularjs.org/api/ng/directive/ngHide
0

you can do something like this in angular:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.