This article explains how to add Angular in Visual Studio. We can add AngularJS in many different ways to develop an application in Visual Studio.
Open Visual Studio 2017.
Go to File >> New >> Project. The "New Project" window will open now. Select ASP.NET Web application (.NET Framework) under the web, give Project name, and click OK.Select "Empty Project" in New ASP.NET Web Application window and click OK.
Open your empty project now. Go to Solution Explorer. You can see all the files of your project here.
We need to add AngularJS script and supporting files to develop an application in AngularJS. Now, we see no supporting files or script files in our project's Solution Explorer.
We are going to add AngularJS script and supporting files. Go to Tools menu, select NuGet Package Manager, and select "Manage NuGet Packages for solutions'.
NuGet-Solution window will open. Go to Browser and type “angularjs” in search text box. You will see all the related AngularJS on the below list.
Select AngularJS like in below screenshot and select check box on the right side. We need to add AngularJS to our project. Finally, click the "Install" button.
Now, click OK button in the preview window that looks like below screenshot.
It will take a few minutes to add AngularJS to our project. After adding AngularJS, we can see this looks like the below message.
Before adding AngularJS, we do not have script folder in our Solution Explorer but now, we can see the script folder. We can see all scripts and support files inside the script folder.
We are going to add a simple page and implement a simple AngularJS page, which we have added. Add simple HTML page and give the name as “Test.htm”.
Inherit Angular script and add the following coding in the test.html page.
<!DOCTYPE html>
<
html
>
<
head
>
<
meta
charset
=
"utf-8"
/>
<
script
src
=
"Scripts/angular.js"
></
script
>
<
title
></
title
>
</
head
>
<
body
ng-app>
<
h2
>Welcome to angularJS Test Page</
h2
>
<
br
/>
<
h3
>Addition</
h3
>
{{10+10}} <
br
/>
<
h3
>Subtraction</
h3
>
{{30-10}} <
br
/>
<
h3
>Multiplication</
h3
>
{{5*4}} <
br
/>
<
h3
>Division</
h3
>
{{100/5}} <
br
/> </
body
>
</
html
>
Build and run the application. We can see the exact output so our AngularJS application is working correctly. We developed simple AngularJS page using which we have added script.
This article explained how to add AngularJS in Visual Studio 2017 in a simple way. I hope this article was very useful to those who are new to learning AngularJS.