GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Karteikarten

Angular concepts

James Drummond Angular A-Level Englisch 40 Karten

Karten in diesem Stapel (40)

  1. 1What is data binding?Two way binding between the view and the model
  2. 2What is the controller?Business logic behind the view
  3. 3What is dependency injection?Pattern that deals with how components get hold of their dependencies
  4. 4What does the Angular compiler do?Parses the template and instantiates directives and expressions
  5. 5What are expressions in Angular?Access variables and functions from the scope
  6. 6What is a directive?Extend HTML with custom attributes and elements
  7. 7What is a service?Enables communication between controllers
  8. 8What is ng-view?ng-view is where the rendered content of the template associated with the route will be displayed
  9. 9What is a module in Angular?A module is an encapsulated section of code pertaining to specific functionality in the application
  10. 10What are some advantages of using modules?- Keep the global namespace clean
    - Isolate functionality, making tests easier to write
    - Make it easy to share code between applications
    - Allows app to load different parts of code in any order
  11. 11What is $scope?$scope serves as the glue between the model and the view
    Scopes are the source of truth for the application state. Because of this live binding, we can rely
    on the $scope to update immediately when the view modifies it, and we can rely on the view to
    update when the $scope changes.
  12. 12What can $scope do?Scopes have the following basic functions:
    • They provide observers to watch for model changes
    • They provide the ability to propagate model changes through the application as well as outside the system to other components
    • They can be nested such that they can isolate functionality and model properties
    • They provide an execution environment in which expressions are evaluated
  13. 13What is dirty checking?This is the process by which every scope object checks its own $watch functions for changes. If any changes are detected, the scope will fire its own callback.
  14. 14What is a controller?It exists to add functionality to the scope of the view
  15. 15What datatypes can be set on a $scope?Any
  16. 16What is the association between $scope and its controller?A controller is used to augment a given $scope. When a controller is created, it is passed a new child scope which encapsulates the scope designated by ng-controller or ng-view
  17. 17How do you access a parent $scope?By using $scope.$parent
  18. 18Is it good practice to have DOM / data manipulation within a controller?No. Controllers should be as thin as possible.
  19. 19How do you prevent a page being rendered with {{}} showing briefly?use ng-cloak on elements containing angular models / directives
  20. 20What is the alternative to using {{}} in an angular page?You can use ng-bind
  21. 21Can you create a service in the config function() (i.e. module('smoothApp,[]).config()No. You can only use provider in the config function.
  22. 22How do you use an expression to apply a style to an element with Angular?ng-style="{color: selectedColor}" where selectedColor is a model or expression
  23. 23What is the alternative to using ng-app?Manually bootstrapping the app: var newElement = document.createElement("div");
    angular.bootstrap(newElement, ['myApp']);
  24. 24When does Angular get to work?When the browser fires the DOMContentLoaded event,
  25. 25What is the point of isolate scope?Don't pollute the global scope
  26. 26How do you create an isolate scope in a directive?Use the attribute 'scope', set to true or {} (it is set to false by default)
  27. 27How do you create a jQuery element with angular?angular.element("
    ")
    - Uses jQlite to create the new element
  28. 28What is $scope in Angular?$scope gives you access to your models.
    This is because $watch expressions have been set up in the $scope on the models.
    - If you want to access a model in a controller, you do it via the $scope
  29. 29What is the 'scope' property in a directive? What is the difference between using '=' and '@' in the scope property?The scope property in a directive specifies whether or not you'd like to create a new (isolated) scope in the directive. '=' and '@' specify whether you would like to use one or two way binding with any properties of the parent scope.
  30. 30What does '&' do when its a property of the scope object in a directive?Executes an expression in the context of the parent scope.
  31. 31What does the property 'transclude' do in a directive?Takes the contents of the directive element to be inserted into the directive template at a place specified by ng-transclude
  32. 32In what order does the compiler sort directives?According to their priority
  33. 33What are the two parts of the compile process?Compile and link
  34. 34How does the $compile service work? (Remember this is different from the compile function)1. Create a DOM element from the HTML
    2. $compile the template
    3. Link the compiled template with the scope
    4. Append to the DOM
  35. 35When would you use the controller function in a directive?When a directive needs to interact with another directive
  36. 36What does the $compile function do?Compiles an HTML string or DOM element into a template and produces a template function which can then be used to link scope and the template together
  37. 37Is it wise to inherit from a primitive - e.g. in a directive?No. Two way binding will not work due to prototypal inheritance.
  38. 38What is a provider?A provider is a low level way of defining a service, factory, value or constant
  39. 39When would you use 'provider'?You can inject provider into the config function - run when the app starts
  40. 40What is the difference between a service and a factory in Angular?- Factory returns an object
    - Service returns an instantiated version of the function

Informationen

Beschreibung
A-Level Angular Karteikarten am Angular concepts, erstellt von James Drummond am 13/12/2014.
Erstellt von
James Drummond
Aufrufe
13
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck