javascript AngularJS 面试问题/挑战
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24231074/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
AngularJS interview questions/challenge
提问by special0ne
I got assigned to interview an AngularJS developer with some know-how in responsive design.
我被指派去面试一位在响应式设计方面有一些专业知识的 AngularJS 开发人员。
Since I like my developers to program during interview, I was thinking on creating a challenge where we can work on together for <1h and then to post the results so I can see them also using my phone/tablet.
因为我喜欢我的开发人员在面试时编程,所以我想创造一个挑战,我们可以一起工作 <1 小时,然后发布结果,这样我也可以使用我的手机/平板电脑看到他们。
Any good AngularJS interview questions/challenges out there?
Is there a service that allows me to do it easily? push the code and view it on my phone browser. - plnkr has an embedded mode but dont know how good it is..
有什么好的 AngularJS 面试问题/挑战吗?
是否有一项服务可以让我轻松完成?推送代码并在我的手机浏览器上查看。- plnkr 有一个嵌入式模式,但不知道它有多好..
回答by jcubic
Good challange will be to create one directive that will do some small responsive UI element. Like a tooltip that will look differently on desktop and browser and will show up differently (on touch and on hover). The person will need to create html template, small resposive css and javascript to hook it up.
好的挑战是创建一个指令来执行一些小的响应式 UI 元素。就像在桌面和浏览器上看起来不同的工具提示,并且会以不同的方式显示(在触摸和悬停时)。该人将需要创建 html 模板、小型响应式 css 和 javascript 来连接它。
I recently needed to create directive like this that will follow the mouse on hover and be static on mobile (but it didn't have responive css - your challange can include that too - have different looking style on a phone).
我最近需要创建这样的指令,它将在鼠标悬停时跟随鼠标并在移动设备上保持静态(但它没有响应的 css - 你的挑战也可以包含它 - 在手机上有不同的外观风格)。
You can prepare base html that this should work on
您可以准备这应该适用的基本 html
<div ng-repeat="item in items">
<span tooltop="item.description" tooltop-options="{color: item.color}">
{{item.text}}
</span>
</div>
It shouldn't take long to create one UI element. If it will be created too fast you can add next challange to create second small directive that will need to exchange data with previous directive (you should not say that he need to create service). it can be directive that render error messages like:
创建一个 UI 元素应该不会花很长时间。如果它创建得太快,您可以添加下一个挑战来创建第二个小指令,该指令需要与前一个指令交换数据(您不应该说他需要创建服务)。它可以是呈现错误消息的指令,例如:
<errors/>
error messages can be responsive using css, so they look nice on mobile and on desktop.
错误消息可以使用 css 进行响应,因此它们在移动设备和桌面上看起来都不错。
and one directive that have
和一个指令有
<something ng-model="someobject"/>
and that something directive need to send error message to error directive for instance if object type is not array.
并且某个指令需要将错误消息发送到错误指令,例如,如果对象类型不是数组。
The person will need to create directive that use ngModel and service that will contain errors and second directive that will render message from error service.
该人将需要创建使用 ngModel 和服务的指令,该指令将包含错误和第二个指令,该指令将呈现来自错误服务的消息。
回答by maurycy
plnkr is very good and flexible, I would go for it, as for AngularJS questions you can get some ideas from articles like this one: http://nathanleclaire.com/blog/2014/04/19/5-angularjs-antipatterns-and-pitfalls/I believe that a skilltest about two-way data binding and scope inheritance would be valueable, maybe resource/animation functionalities - but that depends on the work profile i.e. I don't use animation at all in company projects but in private project I do it heavily with famo.us use
plnkr 非常好而且灵活,我会去,至于 AngularJS 的问题,你可以从这样的文章中得到一些想法:http: //nathanleclaire.com/blog/2014/04/19/5-angularjs-antipatterns-和陷阱/我相信关于双向数据绑定和范围继承的技能测试是有价值的,也许是资源/动画功能 - 但这取决于工作概况,即我在公司项目中根本不使用动画,而是在私下使用项目我用 famo.us 做了很多