TechBeamersTechBeamers
  • Learn ProgrammingLearn Programming
    • Python Programming
      • Python Basic
      • Python OOP
      • Python Pandas
      • Python PIP
      • Python Advanced
      • Python Selenium
    • Python Examples
    • Selenium Tutorials
      • Selenium with Java
      • Selenium with Python
    • Software Testing Tutorials
    • Java Programming
      • Java Basic
      • Java Flow Control
      • Java OOP
    • C Programming
    • Linux Commands
    • MySQL Commands
    • Agile in Software
    • AngularJS Guides
    • Android Tutorials
  • Interview PrepInterview Prep
    • SQL Interview Questions
    • Testing Interview Q&A
    • Python Interview Q&A
    • Selenium Interview Q&A
    • C Sharp Interview Q&A
    • PHP Interview Questions
    • Java Interview Questions
    • Web Development Q&A
  • Self AssessmentSelf Assessment
    • Python Test
    • Java Online Test
    • Selenium Quiz
    • Testing Quiz
    • HTML CSS Quiz
    • Shell Script Test
    • C/C++ Coding Test
Search
  • Python Multiline String
  • Python Multiline Comment
  • Python Iterate String
  • Python Dictionary
  • Python Lists
  • Python List Contains
  • Page Object Model
  • TestNG Annotations
  • Python Function Quiz
  • Python String Quiz
  • Python OOP Test
  • Java Spring Test
  • Java Collection Quiz
  • JavaScript Skill Test
  • Selenium Skill Test
  • Selenium Python Quiz
  • Shell Scripting Test
  • Latest Python Q&A
  • CSharp Coding Q&A
  • SQL Query Question
  • Top Selenium Q&A
  • Top QA Questions
  • Latest Testing Q&A
  • REST API Questions
  • Linux Interview Q&A
  • Shell Script Questions
© 2024 TechBeamers. All Rights Reserved.
Reading: Your First AngularJS Application
Font ResizerAa
TechBeamersTechBeamers
Font ResizerAa
  • Python
  • SQL
  • C
  • Java
  • Testing
  • Selenium
  • Agile Concepts Simplified
  • Linux
  • MySQL
  • Python Quizzes
  • Java Quiz
  • Testing Quiz
  • Shell Script Quiz
  • WebDev Interview
  • Python Basic
  • Python Examples
  • Python Advanced
  • Python OOP
  • Python Selenium
  • General Tech
Search
  • Programming Tutorials
    • Python Tutorial
    • Python Examples
    • Java Tutorial
    • C Tutorial
    • MySQL Tutorial
    • Selenium Tutorial
    • Testing Tutorial
  • Top Interview Q&A
    • SQL Interview
    • Web Dev Interview
  • Best Coding Quiz
    • Python Quizzes
    • Java Quiz
    • Testing Quiz
    • ShellScript Quiz
Follow US
© 2024 TechBeamers. All Rights Reserved.
AngularJSLinux Tutorials

Your First AngularJS Application

Last updated: Jan 15, 2024 12:31 am
By Meenakshi Agarwal
Share
3 Min Read
Write Your First AngularJS App
Write Your First AngularJS App
SHARE

If you’re new to AngularJS development, then this is where you should begin. In this tutorial, you’ll learn to build your very first AngularJS app.

Contents
Step 1: Load frameworkStep 2: Define the AngularJS ApplicationStep 3: Define a ModelStep 4: Bind ModelRun Your First AngularJS AppOutput

We’ll give you a step-by-step process with simple instructions to get you on board quickly.

After reading this, first, create this basic app and then go ahead to build more advanced AngularJS applications.

If you like to quickly brush up on Angular concepts, then go through this list of AngularJS interview questions and answers.

Create Your First AngularJS App

Write Your First AngularJS App
Write Your First AngularJS App

Let’s create a basic <HelloWorld> type application step by step to understand the basic building blocks of AngularJS.

Step 1: Load framework

Since it is a pure JavaScript framework, we should add its reference using the <script> tag.

<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js">
 </script>

Step 2: Define the AngularJS Application

Next, we will define the AngularJS Application using <ng-app> directive.

<div ng-app = "">
 ...
</div>

Step 3: Define a Model

In this step, we’ll define a model <name> using <ng-model> directive.

<p>Enter your Name: <input type = "text" ng-model = "name"></p>

Step 4: Bind Model

Now we will bind a value to the model using <ng-bind> directive.

<p>Welcome <span ng-bind = "name"></span>!!</p>

Run Your First AngularJS App

First, complete all the above steps. Save the file as HTML file <firstAngularJSApp.htm>.

<html>
<head>
<title>AngularJS First Application</title>
</head>

<body>
<h1>My First Application</h1>

<div ng-app = "">
<p>Enter your Name: <input type = "text" ng-model = "name"></p>
<p>Welcome <span ng-bind = "name"></span>!!</p>
</div>

<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>

</body>
</html>

Output

Open <firstAngularJSApp.htm> in a web browser. Once you enter the name of the person, a welcome message gets printed on the screen.

My First Application
Enter your Name: 
Welcome, Meenakshi !!

Here is an insight into the AngularJS code working with HTML.

  • The presence of <ng-app> directive in the HTML marks the start of the AngularJS application.
  • We use <ng-model> directive to create model variables. In this example, it’s <name>. These variables can then be used with the HTML page and within the div having <ng-app> directive.
  • Use of the <ng-bind> directive is to display the value of the model variable using the HTML span tag, whenever the user attaches a value to that variable. In this example value of <name> gets printed after the user enters it in the text box.
  • The closing </div> tag indicates the end of the AngularJS application.

Quick Wrap-up – Your First AngularJS App

We’ve tried to provide all the relevant details about the AngularJS expressions in this tutorial. Hope, you could have learned it easily.

If you liked this post and are interested in seeing more such posts, then follow us on our social media accounts to ensure timely notification for future updates.

Best,

TechBeamers.

You Might Also Like

Basic Linux Commands for Beginners With Examples

How to Use Bash to Replace Character in String

AngularJS Tutorial – History, Present, and Key Terms

Simple Bash Scripting Tutorial for Beginners

20 Bash Script Code Challenges for Beginners with Their Solutions

Meenakshi Agarwal Avatar
By Meenakshi Agarwal
Follow:
Hi, I'm Meenakshi Agarwal. I have a Bachelor's degree in Computer Science and a Master's degree in Computer Applications. After spending over a decade in large MNCs, I gained extensive experience in programming, coding, software development, testing, and automation. Now, I share my knowledge through tutorials, quizzes, and interview questions on Python, Java, Selenium, SQL, and C# on my blog, TechBeamers.com.
Previous Article Learn Everything about AngularJS Expressions from Scratch Learn Everything about AngularJS Expressions
Next Article Python Statement, Multi-line Statement, Expression And Indentation Python Statement and Indentation Explained

Popular Tutorials

SQL Interview Questions List
50 SQL Practice Questions for Good Results in Interview
SQL Interview Nov 01, 2016
Demo Websites You Need to Practice Selenium
7 Sites to Practice Selenium for Free in 2024
Selenium Tutorial Feb 08, 2016
SQL Exercises with Sample Table and Demo Data
SQL Exercises – Complex Queries
SQL Interview May 10, 2020
Java Coding Questions for Software Testers
15 Java Coding Questions for Testers
Selenium Tutorial Jun 17, 2016
30 Quick Python Programming Questions On List, Tuple & Dictionary
30 Python Programming Questions On List, Tuple, and Dictionary
Python Basic Python Tutorials Oct 07, 2016
//
Our tutorials are written by real people who’ve put in the time to research and test thoroughly. Whether you’re a beginner or a pro, our tutorials will guide you through everything you need to learn a programming language.

Top Coding Tips

  • PYTHON TIPS
  • PANDAS TIPSNew
  • DATA ANALYSIS TIPS
  • SELENIUM TIPS
  • C CODING TIPS
  • GDB DEBUG TIPS
  • SQL TIPS & TRICKS

Top Tutorials

  • PYTHON TUTORIAL FOR BEGINNERS
  • SELENIUM WEBDRIVER TUTORIAL
  • SELENIUM PYTHON TUTORIAL
  • SELENIUM DEMO WEBSITESHot
  • TESTNG TUTORIALS FOR BEGINNERS
  • PYTHON MULTITHREADING TUTORIAL
  • JAVA MULTITHREADING TUTORIAL

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

Loading
TechBeamersTechBeamers
Follow US
© 2024 TechBeamers. All Rights Reserved.
  • About
  • Contact
  • Disclaimer
  • Privacy Policy
  • Terms of Use
TechBeamers Newsletter - Subscribe for Latest Updates
Join Us!

Subscribe to our newsletter and never miss the latest tech tutorials, quizzes, and tips.

Loading
Zero spam, Unsubscribe at any time.
x