Explain which means of communication between modules of your application are easily testable?
Submitted by: MuhammadUsing a service is definitely easy to test. Services are injected, and in a test either a real service can be used or it can be mocked.
Events can be tested. In unit testing controllers, they usually are instantiated. For testing events on $rootScope, it must be injected into the test.
Testing $rootScope against the existence of some arbitrary models is testable, but sharing data through $rootScope is not considered a good practice.
For testing direct communication between controllers, the expected results should probably be mocked. Otherwise, controllers would need to be manually instantiated to have the right context.
Submitted by: Muhammad
Events can be tested. In unit testing controllers, they usually are instantiated. For testing events on $rootScope, it must be injected into the test.
Testing $rootScope against the existence of some arbitrary models is testable, but sharing data through $rootScope is not considered a good practice.
For testing direct communication between controllers, the expected results should probably be mocked. Otherwise, controllers would need to be manually instantiated to have the right context.
Submitted by: Muhammad
Read Online AngularJS Developer Job Interview Questions And Answers
Top AngularJS Developer Questions
☺ | Please explain what is Angular Expression? Explain what is key difference between angular expressions and JavaScript expressions? |
☺ | Explain on which types of component can we create a custom directive? |
☺ | Tell me what is AngularJS? |
☺ | Tell me how does the digest phase work? |
☺ | what is DI (Dependency Injection ) and how an object or function can get a hold of its dependencies? |
Top Scripting language Categories
☺ | AngularJS Interview Questions. |
☺ | Ext-JS Interview Questions. |
☺ | Dojo Interview Questions. |
☺ | Expert Developer JavaScript Interview Questions. |
☺ | jQuery Mobile Interview Questions. |