AngularJS is an open-source web application framework written in JavaScript, maintained by Google and a community of individual developers and corporations. It is designed for developing single-page applications (SPA's).
Scope refers to the application model. It acts like glue between application controller and the view. Scopes are arranged in hierarchical structure and impersonate the Document Object Model (DOM) structure of the application. It can watch expressions and propagate events.
Please select exactly one or more correct alternatives.
Answer
During usage of the web application, the page is dynamically changed, and resources are dynamically loaded and added to the page as necessary without the page being reloaded. This results in a more fluent user experience compared to classic web pages.
None of the above is the correct answer because the application throws an error because you have to use a web server (and the http protocol) to load the "data.json" data file.
MVVM stands for Model View ViewModel. It is a solution pattern allowing to develop applications with loose coupling and separation of concern which in turn improves testability, maintainability and extendibility of the software.
MVP stands for Model View Presenter. It is a solution pattern allowing to develop applications with loose coupling and separation of concern which in turn improves testability, maintainability and extendibility of the software.
In AngularJS "services" are the Singleton objects or functions that are used for carrying out specific tasks. It holds some business logic and these function can be called as controllers, directive, filters and so on. You use them for implementing specific functionality that is used regularly in your JavaScript code. This makes your controllers' code "lean".
Data binding is the automatic synchronization (update)of data between the model and view components. The view is a projection of the model at all times. When the model changes, the view reflects the change, and vice versa. So when you update a control's value and this control is bound to a variable, the variable is changed automatically as well.
Please select exactly one or more correct alternatives.
Answer
Each Angular application has exactly one root scope, but may have several child scopes. When Angular evaluates {{name}}, it first looks at the scope associated with the given element for the name property. If no such property is found, it searches the parent scope and so on until the root scope is reached.
On $digest, AngularJS evaluates the scope model. On $apply, AngularJS triggers a $digest cycle. If an expression is passed to $apply(), it is evaluated first, before $digest() is executed.
The digest cycle processes all of the watchers of the current scope and its children. Because a watcher's listener can change the model, the $digest() keeps calling the watchers until no more listeners are firing.
MVC stands for Model View Controller. It is a solution pattern allowing to develop applications with loose coupling and separation of concern which in turn improves testability, maintainability and extendibility of the software.
Which of the statements below are correct on AngularJS scopes?
Please select exactly one or more correct alternatives.
Answer
Each AngularJS application consist of one (1) root scope but may have several child scopes. As child controllers and some directives create new child scopes, the application can have multiple scopes. When new scopes are formed or created, they are added as a children of their parent scope. This is similar to DOM in which a hierarchical structure can be created as well.
Dependency Injection (DI) is a software design pattern that deals with how components get hold of their dependencies. The Angular injector subsystem is in charge of creating components, resolving their dependencies, and providing them to other components as requested.
For creating a directive, the factory method is used. It is invoked only once, when compiler matches the directive for the first time. By using $injector.invoke the factory method is invoked.
In AngularJS "services" are the Singleton objects or functions that are used for carrying out specific tasks. It holds some business logic and these function can be called as controllers, directive, filters and so on.
What is the difference between linking and compiling in AngularJS?
Please select exactly one correct alternative.
Answer
The compile function is used for template DOM manipulation and collect all of the directives. The link function is used for registering DOM listeners as well as instance DOM manipulation. It is executed once the template has been cloned.
Reading
No resources given.
topics: angular, level: 100
Which of the following is true about ng-controller directive?
Please select exactly one correct alternative.
Answer
ng-controller directive tells AngularJS what controller to use with this view. AngularJS application mainly relies on controllers to control the flow of data in the application. A controller is a JavaScript object containing attributes/properties and functions. Each controller accepts $scope as a parameter which refers to the application/module that controller is to control.
Reading
No resources given.
topics: angularjs, level: 100
What is AngularJS linking?
Please select exactly one correct alternative.
Answer
Linking combines the directives with a scope and produce a live view. For registering DOM listeners as well as updating the DOM, the link function is responsible. After the template is cloned it is executed. There are two linking functions:
Pre-linking function: Pre-linking function is executed before the child elements are linked. It is not considered the safe way for DOM transformation.
Post linking function: Post linking function is executed after the child elements are linked. It is safe to do DOM transformation by post-linking function
In AngularJS, during the compilation process the compiler matches text and attributes using the interpolate service to see if they contains embedded expressions. As part of the normal digest cycle, these expressions are updated and registered as watches.
AngularJS routing enables to create different URLs for different content in your web application. Each URL in AngularJS is called a route. Having different URLs for different content enables the user to bookmark URLs to specific content, and share those URLs with others, for example:
What is Angular Protractor and what is it used for?
Please select exactly one correct alternative.
Answer
Protractor is an end-to-end test framework for AngularJS applications. Protractor runs tests against your application running in a real browser, interacting with it as a user would.
What is the difference between one way binding and two way binding?
Please select exactly one correct alternative.
Answer
In one way binding, changes in the model will be reflected in the view. In addition to this, in two way binding, changes in the view will be reflected in the model.
Which statements are correct on AngularJS directives?
Please select exactly one or more correct alternatives.
Answer
An AngularJS directive is like a marker on a DOM element which attaches a special behavior to it. Directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS's HTML compiler ($compile) to attach a specified behavior to that DOM element or even transform the DOM element and its children.
AngularJS expressions are JavaScript-like code snippets that are usually placed in bindings such as {{ expression }}. There are, however, some differences with JavaScript expressions.