AngularJS supports .css() jQuery functionality. Here in below examples we can see how to set style to an element.
Angular2 : If you are looking for Angular2 solution, Please click here

Steps to set style to an elemnt :

  1. Get angular element of html element
  2. Use .css() set  style to that element
var myEl = angular.element( document.querySelector( '#divID' ) );
myEl.css('color','red'));

Set style using ng-style

<html ng-app="" ng-controller="myCtrl">
....
<button ng-click="myStyle={color:'red'}">Set Color</button>
<button ng-click="myStyle={'background-color':'blue'}">Set Background color</button>
<button ng-click="myStyle = {}">Set Background color</button>
<div>Click above buttons</div>
<script>
function myCtrl($scope) {
    $scope.myStyle = {};
}
</script>
Try It Your Self

18 comments:

  1. Replies
    1. Great Article android based projects

      Java Training in Chennai

      Project Center in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Exciting online games with us best casinos online come in and win right now.

    ReplyDelete
  3. Разные виды товаров есть у нас, но лучшее это светодиодная лента купить Украина можно это сделать у компании Экодио

    ReplyDelete
  4. This is really an amazing and thank you so much for sharing

    คาสิโนออนไลน์ที่น่าเชื่อถือและมีความเป็นมืออาชีพที่สุดในตอนนี้
    โปรโมชั่นGclub ของทางทีมงานตอนนี้แจกฟรีโบนัส 50%
    เพียงแค่คุณสมัคร สล็อตออนไลน์ กับทางทีมงานของเราเพียงเท่านั้น
    ร่วมมาเป็นส่วนหนึ่งกับเว็บไซต์คาสิโนออนไลน์ของเราได้เลยค่ะ
    สมัครสล็อตออนไลน์ >>> Goldenslot
    สนใจร่วมสนุกกับ คาสิโนออนไลน์ คลิ๊กได้เลย
    มีทั้งคาสิโนออนไลน์ หวยออนไลน์ ฟุตบอลออนไลน์ สล็อตออนไลน์ และอื่นๆอีกมากมาย

    ReplyDelete
  5. Ez battery reconditioning reviews - You can now easily revive your old batteries with this
    Ez battery reconditioning pdf which provides step by step instructions for reconditiong a battery.
    Ez battery reconditioning blog publishes how ez battery reconditioning reviews programs works
    and where buy ez recondition battery step by step program online after this candid
    Ez battery reconditioning reviews. ez reconditioning batteries is newbie friendly.
    It may help you set up and run your own battery reconditioning business by learning this skill at home.


    How to recondition a battery with Ez battery reconditioning .
    Have you heard about Tom Ericson's Ez battery reconditioning reviews technique and
    are wondering whether it is possible or not.

    visit https://ezbatteryreconditioninginfo.com/ this site to know more. Thank you every one.

    ReplyDelete
  6. Big Truck Tow: Heavy Duty towing service san jose

    We're rated the most reliable heavy duty towing san jose service & roadside assistance in San Jose!
    Call us now! We're ready to help you NOW!

    Since 1999, tow truck san jose has provided quality services to clients by providing them
    with the professional care they deserve. We are a professional and affordable Commercial
    Towing Company. BIG TRUCK TOW provides a variety of services, look below for the list of
    services we offer. Get in touch today to learn more about our heavy duty towing


    Click here to Find tow truck near me

    ReplyDelete
  7. The way you write, you are really a professional blogger. https://eezbatteryreconditioning.com/

    ReplyDelete

  8. This is such an awesome asset, to the point that you are giving and you give it away for nothing.our article has piqued a lot of positive interest. https://ileanbellybreakthrough.com/

    ReplyDelete
  9. Outstanding article! I want people to know just how good this information is in your article. Your views are much like my own concerning this subject. I will visit daily your blog because I know. It may be very beneficial for me. the underground fat loss manual reviews

    ReplyDelete
  10. This is such an awesome asset, to the point that you are giving and you give it away for nothing.our article has piqued a lot of positive interest. https://mikeacnenomore.com/

    ReplyDelete
  11. Excellent read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that. fat burning fingerprint diet

    ReplyDelete
  12. Excellent read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that. beta switch reviews

    ReplyDelete
  13. Excellent read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that. https://the28dayketochallenge.com/

    ReplyDelete
  14. Excellent read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that. rick kaselj

    ReplyDelete
  15. Excellent read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that. https://yogaburnmag.com/

    ReplyDelete
  16. There is noticeably a bundle to know about this. I assume you made certain nice points in features also . product reviews website

    ReplyDelete
  17. I love it here. Keep sharing your good vibes. I love them Are you also searching for Online mathematics help? we are the best solution for you. We are best known for delivering cheap assignments to students without having to break the bank

    ReplyDelete

Blogroll

Follow this blog by Email

Popular Posts