2017-08-03 60 views
-3

在WebStorm中,我可以在同一個項目中運行Angular和Node嗎?有沒有這樣的項目模板?發送數據從nodejs到angularjs

我想從路線的NodeJS發送陣列angularjs

謝謝!

這是我的代碼

conroller.js

  $http({ 
     method: 'GET', 
     url: '/Profil' 
     }).then(function (success){ 
     console.log("i get the data"); 
     $scope.items=success; 
     },function (error){ 

     }); 

文件的NodeJS:

 personne1={FirstName:"a", contry:"usa",LastName:"sfn"}; 
    personne2={FirstName:"b", contry:"usa",LastName:"sfn"}; 
     personne3={FirstName:"x", contry:"usa",LastName:"sfn"}; 
     list=[personne1,personne2,personne3]; 

     console.log("hello from profil"); 

    res.render('Profil',{items:list}); 

回答

0

Angular是一個前端JavaScript庫。 NodeJS是一個使用Chrome's V8 engine作爲後端的運行時環境。一起使用它們是很有可能的。一個這樣的例子是MEAN stack(MongoDB,Express,Angular,Node)。

要開始在Webstorm,Jetbrains has a help page。還有一個starter,你可以從Github抓取。

快樂編碼!

+0

是的,這是exaclty我正在使用,但我試圖從nodejs發送數據到angulars,但它不是'工作形式我這是我的代碼 – dal

+0

請發佈您的代碼在問題中進行更深入的審查 – Brian