Getting started with JS

Hello folks,


I have gone thru angular js for basic FE automation and it's cool. I am going to share very basic hello world example here.

It's very easy and quickly adapt any automation.

Install Node into your system
Download sublime editor


Basic JS file

create mytest.js
mytest.js at  D:/Angular_PlayGround/mytest.js replace path when using at different location.

angular.module('Helloworldapp',[])
    .controller('Helloworldcontroller',function($scope){
        $scope.message = "hello world from js file";
            } );




HTML file


<html> 
   <head>
      <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.5.2/angular.min.js"></script>
      <script type="text/javascript" src="D:/Angular_PlayGround/mytest.js"></script>
   </head>
      <title>Test</title>
   <body  ng-app="Helloworldapp">
      <div ng-controller="Helloworldcontroller">
         <!-- <label>Name:</label>
         <input type = "text" ng-model = "yourName" placeholder = "Enter a name here"> -->
         <label>First Name</label>
         <input type="text" placeholder="Enter" name="firstname" ng-model="name">
         <hr/>

         <!-- <h1>Hello {{yourName}}!</h1> -->
          <!-- <h1>hello {{name}}</h1>  -->
         Hello new binding <span ng-bind="name"></span>
         <p>QA</p>

         <h2>{{message}}</h2>
      </div>

   </body>
</html>
 
 
Go to folder and run html and check that your first program is run.
 
 
Explore and stay tuned. Feel free to write any inputs/comments/suggestions.
 
 
 

Comments

Popular Posts