{"id":2169,"date":"2022-08-30T15:22:37","date_gmt":"2022-08-30T15:22:37","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/04\/do-something-and-continue-class-execution-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:22:37","modified_gmt":"2022-08-30T15:22:37","slug":"do-something-and-continue-class-execution-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/do-something-and-continue-class-execution-collection-of-common-programming-errors\/","title":{"rendered":"Do Something And Continue Class Execution-Collection of common programming errors"},"content":{"rendered":"<p>Make a service instead of doing anything local. This way you can reuse it much easier across your application.<\/p>\n<pre><code>module.factory('$myHttp', ['$http', function($http) {\n  \/\/do your stuff\n  return $http;\n}]);\n<\/code><\/pre>\n<p>And then inside your controllers, directives or any other services, just include it as a dependency and use it like so:<\/p>\n<pre><code>$myHttp.get()\n<\/code><\/pre>\n<p>Here&#8217;s some more info about that:<\/p>\n<p>http:\/\/www.yearofmoo.com\/2012\/10\/more-angularjs-magic-to-supercharge-your-webapp.html#you-should-be-using-custom-services<\/p>\n<p id=\"rop\"><small>Originally posted 2014-01-04 02:50:47. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Make a service instead of doing anything local. This way you can reuse it much easier across your application. module.factory(&#8216;$myHttp&#8217;, [&#8216;$http&#8217;, function($http) { \/\/do your stuff return $http; }]); And then inside your controllers, directives or any other services, just include it as a dependency and use it like so: $myHttp.get() Here&#8217;s some more info [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2169","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2169"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2169\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}