| AngularJS-QA-6 :👈 | 👉:AngularJS-QA-8 |
AngularJS Question Answers - 7 |
| Question: | What is the purpose of the directive 'ng-mousemove'? |
| Answer: | ng-mousemove: Specifies a behavior on mousemove events. |
| Question: | What is the purpose of the directive 'ng-mouseover'? |
| Answer: | ng-mouseover: Specifies a behavior on mouseover events. |
| Question: | How to check a references are equal in AngularJS? |
| Answer: |
Use angular.equals() which returns true if two references are equal
Output:true false true false |
| Question: | What is the purpose of the directive 'ng-mouseenter'? |
| Answer: | ng-mouseenter: Specifies a behavior on mouseenter events. |
| Question: | What is the purpose of the directive 'ng-mouseleave'? |
| Answer: | ng-mouseleave: Specifies a behavior on mouseleave events. |
| Question: | How to convert string to lower case without using filter? |
| Answer: |
Use the angular.lowercase() function which converts a string to lowercase ex:
Output is : “upper case string”
|
| Question: | How to convert string to upper case without using filter? |
| Answer: |
Use the angular.uppercase() function which converts a string to uppercase ex:
Output is : “LOWER CASE STRING”
|
| Question: | What is the purpose of the directive 'ng-mouseup'? |
| Answer: | ng-mouseup: Specifies a behavior on mouseup events. |
| Question: | How to process each value in object collection in Angular JS? |
| Answer: |
User angular.forEach() function which executes a function for each element in an object or array.
The first parameter to the iterator in forEach is the value and second is the key of the object.
|
| Question: | Which means of communication between modules of your application are easily testable? |
| Answer: |
Using 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. |
| AngularJS-QA-6 :👈 | 👉:AngularJS-QA-8 |