{"id":6902,"date":"2014-05-11T07:19:12","date_gmt":"2014-05-11T07:19:12","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/angularjsrelated-issues-collection-of-common-programming-errors\/"},"modified":"2014-05-11T07:19:12","modified_gmt":"2014-05-11T07:19:12","slug":"angularjsrelated-issues-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/angularjsrelated-issues-collection-of-common-programming-errors\/","title":{"rendered":"angularjsRelated issues-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/25b02331ea03bb3408ed04bfa4a885af?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nTim<br \/>\njavascript angularjs angularjs-directive angularjs-ng-repeat<br \/>\nReading the documentation I&#8217;m not sure if I should be doing a pre-compile of this directive or if my methodology doesn&#8217;t work. The error i get is an &#8220;unexpected token email in emails&#8221;.Is it possible that the directive&#8217;s internal controller hasnt passed the email class to the scope of the directive?\/\/html&lt;div data-ng-app = &#8220;appSubs&#8221;&gt; &lt;email-subscription&gt;&lt;\/email-subscription&gt; &lt;\/div &gt;\/\/jsangular.module(&#8216;appSubs&#8217;, []).directive(&#8217;emailSubscription&#8217;, function () {return {restri<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f1bd09a713a4cae4df72ad5848a552e9?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nTrki<br \/>\nangularjs ng-html2js<br \/>\nNo idea what the problem is&#8230;karma.conf.jsfiles: [\/\/ TEMPLATES&#8217;app\/scripts\/directives\/views\/profile_picture.html&#8217;,preprocessors : {\/\/ generate js files from html templates&#8217;app\/scripts\/directives\/views\/profile_picture.html&#8217;: &#8216;ng-html2js&#8217;},ngHtml2JsPreprocessor: {stripPrefix: &#8216;app\/&#8217;,\/\/ setting this option will create only a single module that contains templates\/\/ from all the files, so you can load them all with module(&#8216;templates&#8217;)moduleName: &#8216;templates&#8217;},Then in the test I use:beforeEach(module(<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/220d06c2570e386145b3302bec032cab?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nuser3398172<br \/>\njavascript angularjs twitter-bootstrap tabs<br \/>\nI use angular ui tab (angular-ui.github.io\/bootstrap\/) and expect with ng-repeat I can make it dynamic, means user can add tab. But unexpected it repeat twice. here is the demo http:\/\/plnkr.co\/edit\/iHi1aOfbzsVd1vdX3Tg8?p=previewthe tab work fine with this&lt;tabset vertical=&#8221;true&#8221; &gt;&lt;tab heading=&#8221;{{tab.name}}&#8221;&gt;&lt;div ng-view&gt;&lt;\/div&gt;&lt;\/tab&gt;&lt;tab heading=&#8221;{{tab.name}}&#8221;&gt;&lt;div ng-view&gt;&lt;\/div&gt;&lt;\/tab&gt;&lt;\/tabset&gt;but I added ng-repeat=&#8221;tab in tabs&#8221; to tabset<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/eYEHR.png?s=32&amp;g=1\" \/><br \/>\nQantas 94 Heavy<br \/>\nangularjs karma<br \/>\nI have downloaded project from mean.io and run the karma test case which are present for articles. but all the assertion made in the test are having error like this assertion gives error : Unexpected request: GET articles? Expected GET articles at $httpBackend&#8230;it(&#8216;$scope.find() should create an array with at least one article object &#8216; +&#8217;fetched from XHR&#8217;, function() {\/\/ test expected GET request$httpBackend.expectGET(&#8216;articles&#8217;).respond([{title: &#8216;An Article about MEAN&#8217;,content: &#8216;MEAN rocks!&#8217;}]<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/fad7ffd086b51967c894621b495aaa1d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJoe F<br \/>\nangularjs angularjs-directive angularjs-service<br \/>\nI have created this jsfiddle:http:\/\/jsfiddle.net\/noahgoodrich\/CDwfL\/1\/I have created a set of directives to manage and manipulate navigational tabs. For some reason, when I try to close a tab, it initially removes the appropriate array element, but then the element is replaced with an empty element. Opening tabs seems to work as expected.app.directive(&#8216;navTabOpen&#8217;, [&#8216;$parse&#8217;, &#8216;navTabsService&#8217;, function($parse, navTabsService) {return {restrict: &#8216;A&#8217;,link: function(scope, element, attrs) {scope.ta<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/49d11c19126e225ff02a84d646df25e8?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGuillaumeA<br \/>\njavascript node.js mongodb angularjs express<br \/>\nI&#8217;ve build a simple application with AngularJS. Part of this application is calling REST services. For that, I&#8217;m using mongoose. Everything works great, but I&#8217;d like to better handle errors. A sample code could be :Express:DBCollection.find({}, function (err, tuples) {if (err) {console.log(&#8216;Error!&#8217;);}res.send(JSON.stringify(tuples));});AngularJS:DBService.query(function (res) {$scope.data.lists = res; }); The problem I&#8217;m faced with is as follow. Imagine I&#8217;ve got an error on the mongodb server<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/036231e2c6b242a9dc78812ee48da7b2?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nstackular<br \/>\njavascript html angularjs<br \/>\nAll of the following HTML snippets fail with parsing errors when in a directive template:1.&lt;select ng-model=&#8221;model&#8221; ng-options=&#8221;s.abbreviation as s.name for s in states&#8221; ng-disabled=&#8221;false&#8221;&gt;&lt;\/select&gt;fails with:Error: Syntax Error: Token &#8216;false&#8217; is an unexpected token at column 18 of the expression [state.isDisabled false] starting at [false]2.&lt;select ng-model=&#8221;model&#8221; ng-options=&#8221;s.abbreviation as s.name for s in states&#8221; ng-disabled=&#8221;disabled&#8221;&gt;&lt;\/select&gt;where $scope.disable<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7d55858f2433617058e9ec137fa07590?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSanti<br \/>\nangularjs jsonp jsfiddle<br \/>\nI am trying to run with success the example in http:\/\/jsfiddle.net\/srlopez\/zXPSB\/4\/function MyController($scope, $http) { $http({method: &#8216;JSONP&#8217;,url: &#8216;https:\/\/212.142.196.44\/cardiopen\/episodio\/list\/2&#8217; }). success(function (data, status) {console.log(&#8216;data:&#8217;, data); }). error(function (data, status) {console.log(&#8216;status:&#8217;, status);console.log(&#8216;data:&#8217;, data); });}It reads a JSON from that url but always get errorUncaught SyntaxError: Unexpected token : 212.142.196.44\/cardiopen\/episodio\/list\/2 stat<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3538ea3ebeb28fcbd47a0a53ae765101?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNewKidOnTheBlock<br \/>\njavascript arrays angularjs<br \/>\nI am using the angular ng-repeat function, in my controller i am trying to create an array however i keep getting an error message in my inspector.Uncaught SyntaxError: Unexpected token [ below is a snippet of my code..var app = angular.module(&#8220;homeApp&#8221;, []);app.controller(&#8220;entriesView&#8221;, function ($scope){ $scope.itemEntry = {[{image: &#8220;https:\/\/cms.myspacecdn.com\/cms\/x\/13\/47\/112013-priscilla-600.jpg&#8221;},image1: &#8220;https:\/\/cms.myspacecdn.com\/cms\/x\/13\/47\/112013-priscilla-600.jpg&#8221;];}});can someone let m<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/yjH6F.png?s=32&amp;g=1\" \/><br \/>\nJordan Reddick<br \/>\nangularjs filter indexing key ng-repeat<br \/>\nWhen I filter ng-repeat, this.$index and key both change to reflect the objects position in the filtered array. The problem is that I only see the unfiltered array from the JavaScript so this.$index and key are giving an unexpected result.HTML: &lt;section ng-repeat=&#8221;( key, place ) in places | filter: ({ name : placeName })&#8221; &gt;&lt;button ng-click=&#8217;myFunc( this.$index )&#8217;&gt;Pick {{place.name}}&lt;\/button&gt; &lt;!&#8211; same issue with key &#8211;&gt; &lt;section&gt;Javascript: myFunc(key){ console.log<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n<p>I discovery a place to host code\u3001demo\u3001 blog and websites.<br \/>\nSite access is fast but not money<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.m5zn.com\/newuploads\/2014\/01\/30\/jpg\/e7da807964b1fff.jpg\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tim javascript angularjs angularjs-directive angularjs-ng-repeat Reading the documentation I&#8217;m not sure if I should be doing a pre-compile of this directive or if my methodology doesn&#8217;t work. The error i get is an &#8220;unexpected token email in emails&#8221;.Is it possible that the directive&#8217;s internal controller hasnt passed the email class to the scope of the [&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-6902","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6902","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=6902"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6902\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}