Escolar Documentos
Profissional Documentos
Cultura Documentos
of the
AngularJS phonecat app. You will also learn how to start the development servers bundled with
angular-seed, and run the application in the browser.
Before you continue, make sure you have set up your development environment and installed all
necessary dependencies, as described in Get Started.
In the angular-phonecat directory, run this command:
git checkout -f step-0
To see the app running in a browser, open a separate terminal/command line tab or window, then
run npm start to start the web server. Now, open a browser window for the app and navigate
to http://localhost:8000/app/
Note that if you already ran the master branch app prior to checking out step-0, you may see the
cached master version of the app in your browser window at this point. Just hit refresh to re-load the
page.
You can now see the page in your browser. It's not very exciting, but that's OK.
The HTML page that displays "Nothing here yet!" was constructed with the HTML code shown below.
The code contains some key Angular elements that we will need as we progress.
app/index.html:
<!doctype html>
<html lang="en" ng-app>
<head>
<meta charset="utf-8">
<title>My HTML File</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="css/app.css">
<script src="bower_components/angular/angular.js"></script>
</head>
<body>
</body>
</html>
<html ng-app>
The ng-app attribute represents an Angular directive named ngApp (Angular uses spinal-case for its
custom attributes andcamelCase for the corresponding directives which implement them). This
directive is used to flag the html element that Angular should consider to be the root element of our
application. This gives application developers the freedom to tell Angular if the entire html page or
only a portion of it should be treated as the Angular application.
AngularJS script tag:
<script src="bower_components/angular/angular.js">
This code downloads the angular.js script which registers a callback that will be executed by the
browser when the containing HTML page is fully downloaded. When the callback is executed,
Angular looks for the ngApp directive. If Angular finds the directive, it will bootstrap the application
with the root of the application DOM being the element on which the ngApp directive was defined.
Double-curly binding with an expression:
Nothing here {{'yet' + '!'}}
The binding tells Angular that it should evaluate an expression and insert the result into the DOM in
place of the binding. Rather than a one-time insert, as we'll see in the next steps, a binding will result
in efficient continuous updates whenever the result of the expression evaluation changes.
Angular expression is a JavaScript-like code snippet that is evaluated by Angular in the context of the
current model scope, rather than within the scope of the global context ( window).
As expected, once this template is processed by Angular, the html page contains the text: "Nothing
here yet!".
Source : https://docs.angularjs.org/tutorial/step_00