2016-03-21 15 views
0

Ben açısal yeni, sadece üzerinde elimi deniyorum. Açılığın denetleyicimi bulamadığı konuya takıldım. işte benim için plunkr. http://plnkr.co/edit/D1S0UBha7Dil6gLQNx0w?p=preview. Yardım istiyorum. ctrl.jsKöşede hata, VM1973 angular.js: 11655 Hata: [ng: areq] Argüman 'NewsPostListCtrl' bir işlev değil, undefined var

(function() { 
    "use strict"; 
    angular.module("newspostmodule").controller("NewsPostListCtrl", NewsPostListCtrl); 

    function NewsPostListCtrl() { 
     var newsPostm = this; 
     newsPostm.newsposts = [ 
     { 
      "heading": "header", 
      "author": "author", 
      "postDate": "postDate", 
      "comment": "comment", 
      "like": 2 
     }, 
     { 
      "heading": "header1", 
      "author": "author1", 
      "postDate": "postDate1", 
      "comment": "comment1", 
      "like": 10 
     }] 
    } 
}); 

cevap

0

yerine gelen

(function() { 
    "use strict"; 
    var newsPostsModule = angular.module("newspostmodule", []); 
}()); 

kod yapıyor script.js gelen

Kodu:

function NewsPostListCtrl() { .... 

Sen var newPostListCtrl = function() { ... dikkate denemek ve hatta bunu kayıt olmalıdır yukarıda:

+0

Awesome. Teşekkür ettim .. Değişkeni kullanmadan kodumla neden çalışmadığını açıklar mısınız lütfen? – Pankaj

+0

Ohh .. Sorunu aldım. Sonunda işlevi '()' ile yürütmeyi özledim. – Pankaj

İlgili konular