AngularJS 面试题(基础部分) only English
序言
作为全栈技术框架的一个重要组成部分,AnguarJS 充当是前端框架,其重要性可想而知! 为了强化 AnguarJS的基础,特汇总一些基础概念。
注: 这里的AnguarJS 是指 Angular 1.X (最新版本为 1.7)
AngularJS Interview Questions
A list of top frequently asked AngularJS interview questions and answers are given below.
1) What is AngularJS?
AngularJS is a JavaScript framework i.e. used to create single web page application. It follows MVC (Model View Controller) pattern. It is open source, cross browser compliant and easy to maintain.
2) What are the advantages of AngularJS?
- allows us to create single page application
- follows MVC pattern
- predefined form validations
- supports animation
- open source
- cross browser compliant
- supports two way data binding
- its code are unit testable
3) What are the disadvantages of AngularJS?
- JavaScript Dependent: If end user disables JavaScript, AngularJS will not work.
- Not Secured: It is JavaScript based framework so it is not safe to authenticate user through AngularJS only.
4) Is AngularJS dependent on JQuery?
No.
5) What IDE's are currently used for the development of AngularJS?
- Sublime Text (强烈推荐)
- Visual Studio Code
- WebStorm
- TextMate etc.
6) What are the features of AngularJS?
- MVC
- Validations
- Modules
- Directives
- Templates
- Scope
- Expressions
- Data Binding
- Filters
- Services
- Routing
- Dependency Injection
- Testing
7) What are directives in AngularJS?
Directives are the markers on DOM element that is used to specify behavior on that DOM element. All AngularJS directives start with the word "ng". There are many in-built directives in AngularJS such as "ng-app", "ng-model", "ng-controller", "ng-repeat" etc.
Let's see a simple example of AngularJS directive.
<input type="text" id="empName" ng-model="EmpName"/>
8) What are controllers in AngularJS?
Controllers are JavaScript functions that are used to provide data and logic to HTML UI. It acts as an interface between Server and HTML UI.
9) What are the usage of controllers in AngularJS?
AngularJS Controllers are used to:
- Set up initial state of the $scope object, and
- Add behavior to the $scope object.
10) What is data binding in AngularJS?
Data Binding is the automatic synchronization of data between model and view. There are two ways of data binding:
- One way data binding (used in classical template)
- Two way data binding (used in AngularJS template)
11) What are services in AngularJS?
Services are objects that can be used to store and share data across the application. AngularJS offers many built-in services such as $http i.e. used to make XMLHttpRequest.
12) What is scope in AngularJS?
Scope is an object that represents application model.
Each AngularJS application can have only one root scope but can have multiple child scopes.
13) What is template in AngularJS?
A template consists of HTML, CSS and AngularJS directives that are used to render dynamic view.
14) What are expressions in AngularJS?
Expressions are the code snippets that resolves to a value. AngularJS expressions are placed inside {{expression}}. For example:
{{1+1}}
AngularJS supports one-time binding expressions.
15) What is the use of filter in AngularJS?
A filter is used to format the value of expression to display the formatted output. AngularJS enables us to write our own filter.
参考书: 《 全栈开发之道:MongoDB+Express+AngularJS+Node.js 》
更多全栈技术,请关注微信公众号: “全栈工程师的早读课”,每天早8:00 准时推送技术文章。