{"id":31267,"date":"2024-11-25T14:12:37","date_gmt":"2024-11-25T06:12:37","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31267\/"},"modified":"2024-11-25T14:12:37","modified_gmt":"2024-11-25T06:12:37","slug":"angularjs%e8%bf%87%e6%bb%a4%e5%99%a8%e5%ae%8c%e6%88%90%e6%8e%92%e5%ba%8f%e5%8a%9f%e8%83%bd%e5%ae%9e%e4%be%8b%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31267\/","title":{"rendered":"Angularjs\u8fc7\u6ee4\u5668\u5b8c\u6210\u6392\u5e8f\u529f\u80fd\u5b9e\u4f8b\u8be6\u89e3"},"content":{"rendered":"<p>\u672c\u6587\u4e3b\u8981\u548c\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u4e86angularjs\u4f7f\u7528\u8fc7\u6ee4\u5668\u5b8c\u6210\u6392\u5e8f\u529f\u80fd\uff0c\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u611f\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u4eec\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\u3002<\/p>\n<p><\/p>\n<pre>nbsp;html&amp;gt;&nbsp;\r\n&nbsp;\r\n&nbsp;\r\n&lt;meta&gt;&nbsp;\r\n&lt;title&gt;&lt;\/title&gt;&nbsp;\r\n&lt;script&gt;&lt;\/script&gt;&nbsp;\r\n&lt;link&gt;&nbsp;\r\n&lt;script&gt; \r\nangular.module(&#039;myApp&#039;,[]) \r\n.service(&#039;data&#039;,function(){ \r\nreturn [ \r\n{id:1234,name:&#039;ipad&#039;,price:3400}, \r\n{id:1244,name:&#039;aphone&#039;,price:6400}, \r\n{id:1334,name:&#039;mypad&#039;,price:4400}, \r\n{id:8234,name:&#039;zpad&#039;,price:8400} \r\n]; \r\n}) \r\n.controller(&#039;myController&#039;,function($scope,data){ \r\n$scope.data=data; \r\n$scope.change=function(order){ \r\n\/\/$scope.orderType=&#039;&#039;; \r\n$scope.order=order; \r\nif($scope.orderType==&#039;&#039;){ \r\n$scope.orderType=&#039;-&#039;; \r\n}else{ \r\n$scope.orderType=&#039;&#039;; \r\n} \r\n} \r\n}) \r\n&lt;\/script&gt;&nbsp;\r\n&lt;style&gt; \r\n.red{color: red;} \r\n&lt;\/style&gt;&nbsp;\r\n&nbsp;\r\n&nbsp;\r\n&lt;p&gt;&nbsp;\r\n&lt;nav&gt;&nbsp;\r\n&nbsp;&lt;p&gt;&nbsp;\r\n&nbsp;&lt;\/p&gt;\n&lt;p&gt;&nbsp;\r\n&nbsp;&nbsp;&lt;\/p&gt;\n&lt;form&gt;&nbsp;\r\n&nbsp;&nbsp;&lt;p&gt;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&lt;input&gt;&nbsp;\r\n&nbsp;&nbsp;&lt;\/p&gt;&nbsp;\r\n&nbsp;&nbsp;&lt;\/form&gt;&nbsp;\r\n&nbsp;&lt;\/nav&gt;&lt;\/p&gt;&lt;!-- \/.navbar-collapse --&gt;&nbsp;\r\n&nbsp;&lt;!-- \/.container-fluid --&gt;&nbsp;\r\n&nbsp;\r\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<table>\n  &nbsp; <\/p>\n<thead>\n   &nbsp; <\/p>\n<tr>\n    &nbsp; <\/p>\n<th>id<span><\/span> <\/th>\n<p>&nbsp; <\/p>\n<th>name<span><\/span> <\/th>\n<p>&nbsp; <\/p>\n<th>price<span><\/span> <\/th>\n<p>&nbsp; &nbsp;<br \/>\n  <\/tr>\n<p>&nbsp;\n <\/thead>\n<p>&nbsp; <\/p>\n<tbody>\n   &nbsp; <\/p>\n<tr>\n    &nbsp; <\/p>\n<td>{{x.id}}<\/td>\n<p>&nbsp; <\/p>\n<td>{{x.name}}<\/td>\n<p>&nbsp; &nbsp; <\/p>\n<td>{{x.price}}<\/td>\n<p>&nbsp; &nbsp;<br \/>\n  <\/tr>\n<p>&nbsp;<br \/>\n <\/tbody>\n<p>&nbsp;<br \/>\n<\/table>\n<p>&nbsp; &nbsp; &nbsp; <\/p>\n<p>\u76f8\u5173\u63a8\u8350\uff1a<\/p>\n<\/p>\n<\/p>\n<p><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fAngularjs\u8fc7\u6ee4\u5668\u5b8c\u6210\u6392\u5e8f\u529f\u80fd\u5b9e\u4f8b\u8be6\u89e3\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u4e3b\u8981\u548c\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u4e86angularjs\u4f7f\u7528\u8fc7\u6ee4\u5668\u5b8c\u6210\u6392\u5e8f\u529f\u80fd\uff0c\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u611f\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u4eec\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\u3002 nbsp;html&amp;gt;&nbsp; &nbsp; &nbsp; &lt;meta&gt;&nbsp; &lt;title&gt;&lt;\/title&gt;&nbsp; &lt;script&gt;&lt;\/script&gt;&nbsp; &lt;link&gt;&nbsp; &lt;script&gt; angular.module(&#039;myApp&#039;,[]) .service(&#039;data&#039;,function(){ return [ {id:1234,name:&#039;ipad&#039;,price:3400}, {id:1244,name:&#039;aphone&#039;,price:6400}, {id:1334,name:&#039;mypad&#039;,price:4400}, {id:8234,name:&#039;zpad&#039;,price:8400} ]; }) .controller(&#039;myController&#039;,function($scope,data){ $scope.data=data; $scope.change=function(order){ \/\/$scope.orderType=&#039;&#039;; $scope.order=order; if($scope.orderType==&#039;&#039;){ $scope.orderType=&#039;-&#039;; }else{ $scope.orderType=&#039;&#039;; } } }) &lt;\/script&gt;&nbsp; &lt;style&gt; .red{color: red;} &lt;\/style&gt;&nbsp; &nbsp; &nbsp; &lt;p&gt;&nbsp; &lt;nav&gt;&nbsp; &nbsp;&lt;p&gt;&nbsp; &nbsp;&lt;\/p&gt; &lt;p&gt;&nbsp; &nbsp;&nbsp;&lt;\/p&gt; &lt;form&gt;&nbsp; &nbsp;&nbsp;&lt;p&gt;&nbsp; &nbsp;&nbsp;&nbsp;&lt;input&gt;&nbsp; &nbsp;&nbsp;&lt;\/p&gt;&nbsp; &nbsp;&nbsp;&lt;\/form&gt;&nbsp; &nbsp;&lt;\/nav&gt;&lt;\/p&gt;&lt;!&#8211; \/.navbar-collapse &#8211;&gt;&nbsp; &nbsp;&lt;!&#8211; \/.container-fluid &#8211;&gt;&nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-31267","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=31267"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31267\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}