Malekbenz

Hi, I'm MalekBenz. I author this blog, I'm FullStack Developer, create courses & love learning, writing, teaching technology. ( Javascript, C#, ASP.NET , NodeJS, SQL Server )

First Angularjs application with Visual Studio

AngularJS JavaScript-based front-end web application framework, it alows you to easily build single-page web applications (SPA).

AngularJS provide a framework for client-side model–view–controller (MVC) and model–view–viewmodel (MVVM) architectures, along with components commonly used in rich Internet applications. You can download Visual studio community.

Create a web application

With Visual Studio New Project:

CMD

Name your project and click Ok.

CMD

Select Empty project template and click Ok.

CMD

Add the following code inside your body tag.

    <h1> index.html </h1>

CMD

Run a project :

CMD

What about AngularJS

To install AngularJs you can download from the official web site. OR Right click on a project click Manage nuGet package.

CMD

Search for angularjs and click install.

CMD

Now add you angular.js script to you index.html

    <script src="Scripts/angular.js"></script>

index.html :

        <!DOCTYPE html>
        <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <title></title>
            </head>
            <body ng-app="myapp">
                <div ng-controller="mycontroller">
                    <h1></h1>
                </div>

                <script src="Scripts/angular.js"></script>
                <script>
                    var app = angular.module("myapp", []);
                    app.controller("mycontroller", fnController);
                    function fnController($scope) {
                        $scope.message = "Hello From Angularjs App";
                    };
                </script>
            </body>
        </html>

index.html file should look like :

vs code

Run the application

vs code

First angular js application

Comments