{"id":203,"date":"2017-03-22T11:52:15","date_gmt":"2017-03-22T11:52:15","guid":{"rendered":"http:\/\/codeinsightacademy.com\/blog\/?p=203"},"modified":"2017-05-13T05:23:09","modified_gmt":"2017-05-13T05:23:09","slug":"directives","status":"publish","type":"post","link":"https:\/\/codeinsightacademy.com\/blog\/angular-js\/directives\/","title":{"rendered":"Directives"},"content":{"rendered":"<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;DOCTYPE html&gt;\r\n&lt;html&gt;\r\n    &lt;head&gt;\r\n        &lt;meta CHARSET=\"UTF-8\"&gt;\r\n        &lt;script src=\"http:\/\/ajax.googleapis.com\/ajax\/libs\/angularjs\/1.4.8\/angular.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;\/head&gt;\r\n    &lt;body ng-app=\"\"&gt;\r\n        &lt;fieldset&gt;\r\n            &lt;legend&gt;\r\n                Single Variables\r\n            &lt;\/legend&gt;\r\n            &lt;div ng-init=\"name = 'Angular JS'\"&gt;\r\n                Hello {{name}}\r\n            &lt;\/div&gt;\r\n        &lt;\/fieldset&gt;\r\n        &lt;fieldset&gt;\r\n            &lt;legend&gt;\r\n                Multiple Variables\r\n            &lt;\/legend&gt;\r\n            &lt;div ng-init=\"first_name = 'Angular';last_name = 'JS'\"&gt;\r\n                Hello {{first_name + ' ' + last_name}}\r\n            &lt;\/div&gt;\r\n        &lt;\/fieldset&gt;\r\n        &lt;fieldset&gt;\r\n            &lt;legend&gt;\r\n                Model\r\n            &lt;\/legend&gt;\r\n            &lt;div ng-init=\"model_variable = 'Hello Model'\"&gt;\r\n                &lt;input type=\"text\" ng-model=\"model_variable\" \/&gt;\r\n                Hello {{model_variable}}\r\n                &lt;div ng-bind=\"model_variable\"&gt;&lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/fieldset&gt;\r\n        &lt;fieldset&gt;\r\n            &lt;legend&gt;\r\n                JSON objects\r\n            &lt;\/legend&gt;\r\n            &lt;div ng-init=\"months={'first':'January', 'last':'December'}\"&gt;\r\n                First Month : {{months.first}} &lt;br\/&gt;\r\n                Last Month : {{months.last}}\r\n            &lt;\/div&gt;\r\n        &lt;\/fieldset&gt;\r\n        Hello {{'World'}}\r\n    &lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; &lt;DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta CHARSET=&#8221;UTF-8&#8243;&gt; &lt;script src=&#8221;http:\/\/ajax.googleapis.com\/ajax\/libs\/angularjs\/1.4.8\/angular.min.js&#8221;&gt;&lt;\/script&gt; &lt;\/head&gt; &lt;body ng-app=&#8221;&#8221;&gt; &lt;fieldset&gt; &lt;legend&gt; Single Variables &lt;\/legend&gt; &lt;div ng-init=&#8221;name = &#8216;Angular JS'&#8221;&gt; Hello {{name}} &lt;\/div&gt; &lt;\/fieldset&gt; &lt;fieldset&gt; &lt;legend&gt; Multiple Variables &lt;\/legend&gt; &lt;div ng-init=&#8221;first_name = &#8216;Angular&#8217;;last_name = &#8216;JS'&#8221;&gt; Hello {{first_name + &#8216; &#8216; + last_name}} &lt;\/div&gt; &lt;\/fieldset&gt; &lt;fieldset&gt; &lt;legend&gt; Model &lt;\/legend&gt; &lt;div ng-init=&#8221;model_variable = &#8216;Hello Model'&#8221;&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"quote","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/posts\/203"}],"collection":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/comments?post=203"}],"version-history":[{"count":3,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/posts\/203\/revisions"}],"predecessor-version":[{"id":283,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/posts\/203\/revisions\/283"}],"wp:attachment":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/media?parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/categories?post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/tags?post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}