\u3055\u304d\u307b\u3069\u306e\u304a\u6c17\u306b\u5165\u308a\u30dc\u30bf\u30f3\u3092\u4f8b\u306b\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n
<div ng-controller="MainsController">\n <span ng-class="red: isFavorite">\u304a\u6c17\u306b\u5165\u308a\u3055\u308c\u3066\u305f\u3089\u8d64\u304f\u306a\u308a\u307e\u3059\u3002<\/span>\n <button ng-click="favorite()">\u304a\u6c17\u306b\u5165\u308a<\/button>\n <button ng-click="removeFavorite()">\u304a\u6c17\u306b\u5165\u308a\u304b\u3089\u5916\u3059<\/button>\n<\/div><\/code><\/pre><\/div>\n\n\n\nconst MainsCtrl = angular.module('MainsController');\nconst MainsController = function(){\n $scope.isFavorite = false;\n $scope.favorite = function(){\n isFavorite = true;\n }\n $scope.removeFavorite = function(){\n isFavorite = false;\n }\n}<\/code><\/pre><\/div>\n\n\n\n.red{\n color: red;\n}<\/code><\/pre><\/div>\n\n\n\n<\/span>\u89e3\u8aac<\/span><\/h2>\n\n\n\n\u8981\u306f\u3001ng-class=\"red: isFavorite\"<\/code>\u3068\u3059\u308b\u3068\u3001isFavorite<\/code>\u304ctrue<\/code>\u306e\u3068\u304d\u3060\u3051\u3001.red<\/code>\u30af\u30e9\u30b9\u304c\u4ed8\u304f\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u4e00\u822c\u306bng-class=\"[\u4ed8\u3051\u305f\u3044\u30af\u30e9\u30b9\u540d]: [\u30d5\u30e9\u30b0\u306e\u5909\u6570\u540d]\"<\/code>\u3067\u3059\u3002<\/p>\n\n\n\n<\/span>\u307e\u3068\u3081<\/span><\/h2>\n\n\n\n\u3061\u3087\u3063\u3068\u3057\u305f\u3053\u3068\u304c\u3001\u3061\u3087\u3063\u3068\u3057\u305f\u30b3\u30fc\u30c9\u3067\u51fa\u6765\u308b\u306e\u3067\u7c21\u5358\u3067\u3059\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u6700\u8fd1AngularJS\u306b\u306f\u307e\u3063\u3066\u308b\u306e\u3067\u3001AngularJS\u3092\u52c9\u5f37\u3057\u3066\u899a\u3048\u305f\u3053\u3068\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002 \u53c2\u8003\u66f8\u7c4d: AngularJS\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u30ac\u30a4\u30c9 \u30d5\u30ed\u30f3\u30c8\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3057\u3066\u3044\u308b\u3068\u3001\u6761\u4ef6\u306b\u3088\u3063\u3066\u8981\u7d20\u306e\u30b9\u30bf\u30a4\u30eb\u3092\u5909 […]<\/p>\n","protected":false},"author":1,"featured_media":208446,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[41,5],"tags":[155,153,45,154,42,43,40],"class_list":["post-3582","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","category-program","tag-angular","tag-angularjs","tag-css","tag-frontend","tag-html","tag-javascript","tag-web"],"aioseo_notices":[],"jetpack_featured_media_url":"http:\/\/cms.inter-arteq.com\/wp-content\/uploads\/2022\/03\/angularjs_toggle_style_with_ng_class.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/posts\/3582"}],"collection":[{"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/comments?post=3582"}],"version-history":[{"count":5,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/posts\/3582\/revisions"}],"predecessor-version":[{"id":208407,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/posts\/3582\/revisions\/208407"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/media\/208446"}],"wp:attachment":[{"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/media?parent=3582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/categories?post=3582"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/tags?post=3582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}