2016-08-09 19 views
0

我是AngularJs的新手,這是我的第一個代碼。我發現了一個在線 教程其中模塊被聲明這樣Angularjs。模塊沒有顯示在intellisense

變種的myapp = angular.module( '對myApp',[])

當I型角。 ,我無法將.module顯示在我的智能感知 中,而是獲取$$ modulename。

我做錯了什麼?當我輸入模塊時,代碼實際運行。

這是我的代碼如下。

 <!DOCTYPE html> 
     <html xmlns="http://www.w3.org/1999/xhtml"> 
     <head> 
      <title>Practicing Angular</title> 
      <script src="../Scripts/angular.min.js"></script> 
     </head> 
     <body> 
      <h1>Hello This is the first page</h1>  

      <div ng-app="myApp" ng-controller="myCtrl"> 

       First Name: <input type="text" ng-model="firstName"><br> 
       Last Name: <input type="text" ng-model="lastName"><br> 
       <br> 
       Full Name: {{firstName + " " + lastName}} 
      </div> 
      <script> 
       var app = angular.module('myApp', []); 
       app.controller('myCtrl', function ($scope) { 
        $scope.firstName = "John"; 
        $scope.lastName = "Doe"; 
       }); 
      </script> 
     </body> 
     </html> 
+0

什麼都沒有顯示出來 – Sajeetharan

+0

當我輸入角度時,.module沒有出現在intellisense中。 ... – user2320476

回答

0

嘗試原來angular.min.js而不是鏈接,

<head> 
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"> </script></head> 

,因爲它在我的工作VS 2012

printSceen

+0

謝謝。我嘗試了原始的和相同的東西。我無法獲得.module。通常我不認爲你可以在生產環境中使用原件,因爲你沒有任何控制權。始終推薦使用本地版本 – user2320476

+0

我正在使用vs2013專業版。 – user2320476

+0

我知道你使用本地腳本更安全。但只是爲了測試我所說的使用鏈接的任何方式。 – monikapatel

0

下載angular.intellisense.js,並把它放在你的「 Program Files(x86)\ Microsoft Visual Studio 12.0 \ JavaScript \ References「文件夾。

使用NuGet包管理器從www.angularjs.org

安裝AngularJS現在引用添加到angular.jsangular.min.js和你的視覺工作室應該有一個AngularJS更好的支持,你應該開始看到智能感知。