Angular1面试题目总结(来自Ultimate Angular)

本文参考Ultimate Angular网站创始人Todd Motto的原文,总结了他认为的比较重要的,能够体现工程师技术能力的Angular1中的技术点。他的原文(https://toddmotto.com/modern-angular-interview-questions)里就没有提供答案,自寻答案吧。。。

Components 组件

      • What is a “component”?
      • When would you use a component over a directive?
      • What is component architecture?
      • What is the difference between a stateful and stateless component?
      • What are lifecycle hooks and why are they important?
      • When would you consider one-way dataflow over two-way?
      • Why is isolate scope an important concept?
      • How would you describe “MVC/MVVM”?
      • What is the difference between MVC/MVVM and component architecture?
      • What types of bindings can a component receive?
      • Can you describe immutable datastructures?
      • Give an example of an immutable operation in JavaScript

State management and dataflow 状态管理和数据流

      • How do you get data into a component?
      • How do you get data out of a component?
      • What benefits does unidirectional dataflow bring?
      • What are common problems with multidirectional dataflow?
      • Have you ever used $ngRedux or a similar implementation?
      • What benefits does a Redux approach with AngularJS bring?

Performance and debugging 性能与debug

      • What are key areas you can address for faster $digest cycles?
      • What are the benefits to using one-time binding expressions?
      • What can lead to memory leaks in AngularJS?
      • How would you speed up an ng-repeat?
      • How does track by work?
      • What are $evalAsync and $applyAsync?
      • What are the differences between $watch and $watchCollection?
      • Explain how you would attempt to debug an AngularJS performance issue
      • What debugging tools are you familiar with?
      • What is strict-di mode and how does it affect runtime performance?
      • What tools have you used to make Angular faster?
      • What is the $templateCache?

Modules and internals 模块

      • What are the key building blocks of an Angular application?
      • How would you describe a module?
      • What use case do sub-modules have?
      • What have you learned from studying the Angular source code?
      • How do you bootstrap Angular asynchronously?
      • How can you bootstrap multiple applications at once?
      • What is dependency injection (DI)?
      • Why is dependency injection useful in Angular?
      • How does the $digest cycle work?
      • What is $rootScope and how does it differ to $scope?
      • When have you used $scope.$apply, and why?

Directives指令

      • What is a directive?
      • What directive(s) implement true two-way databinding?
      • Why use ng-click over addEventListener?
      • When would you use addEventListener?
      • What is the link function and when should you use it?
      • How do you use the link function to communicate back to the controller?
      • What logic should live inside link, and what logic should live in the controller?
      • What is the compile function and what can it return?
      • What are the pre and post link lifecycle methods?
      • Why can the compile function be more effective than link?
      • When would you use a directive over a component?
      • What are event directives, and what are structural directives?
      • What problems have you faced when using directives?
      • What practices should you avoid when using directives?
      • What types of bindings can a directive receive?
      • When would you use require, and what effect does it have on link?
      • What is transclusion?
      • What directive properties would you recommend avoiding?
      • What directives do you tend to avoid and why?
      • What different types of scope are there?
      • What is JQLite and does it have any limitations?

Forms表单

      • How would you implement form validation using the form’s controller?
      • What do dirty, pristine, touched and untouched mean?
      • What limitations do AngularJS forms have?
      • What are some of the built-in validators?
      • _What are $parsers and $formatters, and when should you use them?
      • _What is the $validators pipeline, and when should you use it?
      • What is ngModelOptions and is it a good directive to implement?

Routing路由

      • What is routing?
      • What is component routing?
      • When would you use a template route, if ever?
      • What is a dynamic route and how do you implement it?
      • What is “HTML5 mode”?
      • How would you render a view only when the data has become available?
      • What are transition hooks and what role do they play in routing?
      • How do you create sibling views?

Controller控制器

      • What is the role of a controller?
      • How would you get data into a controller?
      • When would you use $scope.$watch? Should you? How do you unwatch?
      • Explain when you would use controllerAs and the effect it has
      • When should you use $scope inside a controller?
      • When would you consider using a nested controller? Is it good practice?

Filters过滤器

      • What is a filter?
      • How does a filter actually work?
      • What is the most performant approach to filtering data and why?
      • How do you use multiple filters at once in templates?
      • How do you use multiple filters at once inside a controller?
      • How do you pass arguments to a custom filter?

Service and HTTP 服务与HTTP

      • What is a service?
      • What is a factory?
      • What is a provider?
      • What design patterns do services and factories promote?
      • What is a service’s role in an Angular application?
      • What’s the difference between $http and $resource?
      • When could it make sense to use $resource over $http?
      • What is a Promise? Name some places Angular uses them.
      • What is $q and when would you use it?
      • What is an http interceptor and what are good use cases for it?
      • What different types of authentication have you implemented?

Event 事件机制

      • When should you use events in AngularJS?
      • What’s the difference between $emit and $broadcast?
      • What’s the difference between $scope.$emit and $rootScope.$emit?
      • How does event unbinding differ in $scope and $rootScope?

Testing and Tooling测试与工具

      • What is the difference between a unit and end-to-end (e2e) test?
      • What tools have you used for unit testing?
      • What tools have you used for end-to-end (e2e) testing?
      • What tooling are you familiar with?
      • Describe how lazy-loading works
      • What build step processes are effective for faster Angular applications?
      • Are you using ES6 transpilers or TypeScript?

Leave a Reply

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