InfoHeap
Tech tutorials, tips, tools and more
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

AngularJS

  • Hello world
  • ng-init
  • ng-model
  • Controller to increment value
  • Controller - basic clock
  • Controller - ajax
  • date filter
  • include template (url)
  • include template (inline)
  • tabs using ng-switch
  • conditional style using ng-style
  • animation with ng-class
  • ng-if vs ng-hide/ng-show

AngularJS Directives

  • ng-bind
  • ng-bind-html
  • ng-bind-template
  • ng-blur
  • ng-change
  • ng-checked
  • ng-class
  • ng-class-even and ng-class-odd
  • ng-click
  • ng-cloak
  • ng-dblclick
  • ng-disabled
  • ng-focus
  • ng-hide
  • ng-href
  • ng-if
  • ng-list
 
  • Home
  • > Tutorials
  • > Javascript
  • > AngularJS

AngularJS hello world example

By admin on Jan 25, 2016

Angularjs is a web application framework which has gained lot of popularity in mobile and single page applications. It uses directive ng-app to represent root of the element. Here is a basic angular js hello world example.

<div ng-app="myApp">
  <label>Name:</label>
  <input type="text" ng-model="yourName" ng-init="yourName='Foo'">
  <hr>
  <b>Hello {{yourName}}!</b>
<div/>

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script>
<script type="text/javascript">
var module = angular.module("myApp", []);
</script>
refresh done
try it online

Few points to note

  1. Here is how the html looks when inspected in Chrome developer tools
    angularjs-hello-world-inpect-dom
  2. Angularjs scans the whole page and looks for ng-app elements.
  3. Note the presence of classes (ng-scope, ng-binding) angularjs has added.
  4. We could have initialized yourName value in angularjs controller also.

Suggested posts:

  1. AngularJS simple controller tutorial to increment a value
  2. AngularJS controller basic clock example
  3. How to include angularjs javascript in wordpress post
  4. AngularJS controller ajax examples
  5. React jsx hello world
  6. AngularJS – display html without escaping using ng-bind-html
  7. Edit and debug css in Chrome
  8. view event handlers in Chrome
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged AngularJS, Chrome developer tools, Javascript, Tutorials

Follow InfoHeap

facebook
twitter
googleplus
  • Browse site
  • Article Topics
  • Article archives
  • Recent Articles
  • Contact Us
  • Omoney
Popular Topics: AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries

Copyright © 2021 InfoHeap.

Powered by WordPress