TutorialLesson 20Free preview
AngularJS API
This lesson is part of AngularJS · All levels
Summary
AngularJS provides a suite of service APIs such as $window, $timeout, $interval, and $location that wrap browser objects. By wrapping it through service, the code becomes easier to test and remains tied to the digest cycle. For example, $interval makes automatic updates without the need for a $apply manual.
Key points
- $window wrapping the object window browser
- $timeout and $interval act as setTimeout/setInterval but trigger digest
- $location makes it easy to manipulate URLs
- Browser API packing makes testing easier with mock
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.