concept syntax in category angular

appears as: syntax, syntax
AngularJS in Action

This is an excerpt from Manning's book AngularJS in Action.

Table 1.1. AngularJS at a glance

Component

Purpose

Module Modules serve as containers to help you organize code within your AngularJS application. Modules can contain sub-modules, making it easy to compose functionality as needed.
Config The config block of an AngularJS application allows for configuration to be applied before the application actually runs. This is useful for setting up routes, dynamically configuring services, and so on.
Routes Routes allow you to define ways to navigate to specific states within your application. They also allow you to define configuration options for each specific route, such as which template and controller to use.
Views The view in AngularJS is what exists after AngularJS has compiled and rendered the DOM with all of the JavaScript wiring in place.
$scope $scope is essentially the glue between the view and controller within an AngularJS application. With the introduction of the controller-as syntax, the need to explicitly use $scope has been greatly reduced.
Controller The controller is responsible for defining methods and properties that the view can bind to and interact with. As a matter of best practice, controllers should be lightweight and only focus on the view they’re controlling.
Directive A directive is an extension of a view in AngularJS in that it allows you to create custom, reusable elements that encapsulate behavior. You can think of directives as components or decorators for your HTML. Directives are used to extend views and to make these extensions available for use in more than one place.
Service Services provide common functionality to an AngularJS application. For instance, if you have data that more than one controller needs, you would promote that data to a service and then make it available to the controllers via the service. Services extend controllers and make them more globally accessible.

3.3.2. Controller as syntax

In AngularJS 1.3, a new convention was introduced for working with controllers known as the controller-as syntax. In a hypothetical situation, instead of declaring a controller on the view as ng-controller="StoryboardCtrl", you’d define it as ng-controller ="StoryboardCtrl as storyboard". Throughout the rest of the view, you’d refer to that controller as storyboard. For instance, if you wanted to bind to someProperty that existed on the controller, it would look like {{storyboard.someProperty}} and not {{someProperty}}.