Angular js. Modules, directives, controllers, expressions, MVC

Home » Tutorials » JavaScript » Angular js. Modules, directives, controllers, expressions, MVC
In last lesson. Today we begin to build simple angular app, while discussing the basic concepts – directives, modules, expressions, controllers, and shortly consider approach to build apps – MVC (Model-View-Controller).
Let’s discuss key definitions of this lesson:

  • Module initializes your app and is container of different app parts (for example, controllers).
  • Directives are additional html tags attributes. They extend behavior ща html. Angular has got a lot of build-in directives, but you also to define your custom directives. Directives begins from ng- suffix. For example, ng-app.
  • Expressions bind data to html.
    You can write arithmetic operations or call functions and so on. Expressions are written in double curly braces.

Let’s consider MVC (Model View Controller). This approach implies separation of your app into three different large parts – Model, View, Controller. Each of them does its own task. Model gives data for rendering. View renders this data. Controller is connection link between model and view. It passes data to model from view and vice versa. In angular controllers there are $scope. $scopre is simply javascript object. But in angular context $scope is really scope of variables. You can add new properties to $scope, which will be visible only in current $scope. Furthermore they will be visible only in controller, which $scope is defined.


Submit a Comment

Your email address will not be published. Required fields are marked *

Подписаться на рассылку

Будьте в курсе - получайте последние статьи на свой email

Ваша подписка успешно оформлена

Pin It on Pinterest

Share This