InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Custom Validation |
|
Answer» Custom Validation |
|
| 2. |
AngularJS Events |
|
Answer» AngularJS Events The ng-click DirectiveThis ng-click directive defines AngularJS code that will execute on element is being clicked. ![]() Example No 2 for ng-click![]() Toggling True and FalseIf we want to show a section of HTML code hide or show when we click on button. Same we do on dropdown MENU and make the button behave like toggle switch:- ![]() In above figure showtopic variable starts out as the boolean value as false. With myFunc function sets the showtopic variable to opposite of what it is by using the not operator. $event ObjectWe can also PASS $event object as an argument when we CALL the function.The $event object CONTAINS the browser event object. Below example will be more clear to you:-
|
|
| 3. |
AngularJS $http |
|
Answer» AngularJS $http |
|
| 4. |
AngularJS API |
|
Answer» AngularJS API (1)angular.lowercase()var app = angular.module('myTestApp', []); app.controller('myTestCtrl', function($SCOPE) { $scope.x1 = "ADAM SUTRO"; $scope.x2 = angular.lowercase($scope.x1); }); (2)angular.uppercase()var app = angular.module('myTestApp', []); app.controller('myTestCtrl', function($scope) { $scope.x1 = "adam sutro"; $scope.x2 = angular.uppercase($scope.x1); }); (3)angular.isString()var app = angular.module('myTestApp', []); app.controller('myTestCtrl', function($scope) { $scope.x1 = "ADAM SUTRO"; $scope.x2 = angular.isString($scope.x1); }); (4)angular.isNumber()var app = angular.module('myTestApp', []); app.controller('myTestCtrl', function($scope) { $scope.x1 = "ADAM"; $scope.x2 = angular.isNumber($scope.x1); }); |
|
| 5. |
AngularJS HTML DOM |
|
Answer» AngularJS HTML DOM The ng-disabled DirectiveWe use ng-disabled directive to binds AngularJS application data to disabled attributes of HTML elements. Below is the example which helps you understand ng-disabled directive:- ![]() Below are the 3 point for above images (1)As in above figure ng-disabled directive binds the application data myTestSwitch to the HTML BUTTON disabled attribute. (2)And ng-model directive binds the value of HTML checkbox element to the value of myTestSwitch. (3)If values of myTestSwitch evalutes to true the button will be disabled. The ng-show DirectiveWe use this ng directive to either SHOWS or hides an HTML elements. Below example will helps you to under that:- ![]() In above image we will use ng-show to DISPLAY some value by putting as "true" then it is visible if you PUT as "false" it will hide the values The ng-hide DirectiveAs we use ng-show in similar way we will use ng-hide directive to hide some values
|
|
| 6. |
AngularJS Database |
|
Answer» AngularJS Database |
|
| 7. |
Validation Example |
|
Answer» Validation Example |
|
| 8. |
Validation CSS |
|
Answer» Validation CSS |
|
| 9. |
Select Option 2 |
|
Answer» SELECT Option 2 In previous chapter we have learn bind dropdown list with array. Now we WOULD TRY binding dropdown list with object. Below is the example of object with key-value pairs:- $scope.Employees = { Emp01 : "Adam", Emp02 : "TIM", Emp03 : "John" }; The expression in ng-options is littlebit different for objects. In below example we have taken an object which have values in key-value like x present as the key and y present as the value. ![]() One more example where in object we have 3 values as given in below object and example $scope.EMployees = { Emp01 : {EmpName : "Adam", Department : "IT", Skill : "MCA"}, Emp02 : {EmpName : "Tim", Department : "Admin", Skill : "MBA"}, Emp03 : {EmpName : "Bob", Department : "HR", Skill : "MBA"} };
|
|
| 10. |
Form Validation |
|
Answer» Form Validation Required FieldHere we will use HTML5 attribute required to specify that input field must have some values. As below example:- ![]() Here we use HTML5 type email to specify that the value must be an email. And below is the example:- ![]() Now we read most important aspects in form state and input state Form State and Input StateAngularJS constantly update the state of both the form and Input fields. Below are different Input fields have the following states:- (1)$untouched This will happen when field has not been touched yet (2)$touched This will happen when field has been touched (3)$PRISTINE This will happen when field has not been modified yet (4)$dirty This will happen when field has been modified (5)$invalid This will happen when field content is not valid (6)$valid This will happen when field content is valid All of above properties of input field EITHER true or false. Below are different Forms states:- (1)$pristine When No fields have been modified yet (2)$dirty when One or more have been modified (3)$invalid When form content is not valid (4)$valid when form content is valid (5)$submitted when form is submitted All of above properties either true or false. From above properties we have use one touched example which will helps you to understand
|
|
| 11. |
AngularJS Forms |
|
Answer» AngularJS Forms Input ControlsBelow are THR HTML input elements:- (1)input elements (2)select elements (3)button elements (4)textarea elements with the help ng-model directive we will bind input controls which provides data-binding. Below is the example which helps you to understand the data-binding. In below example we will understand that application have a property named employeename. And in below example ng-model directive binds the input CONTROLLER to the rest of our application. And in below example the property employeename can be referred to in a controller:- ![]() And in another example we can also referred to another place of application:- ![]() CheckboxAs we knows the checkbox has the two values either true or false. If check box is checked then it is true we use this value in our application to display some values by using ng-show directives. ![]() RadiobuttonsIn below example we will bind radio button to our application with ng-model directive with 3 values. And same ng-model have different values and we will display only the selected one. ![]() In Above example myTestVar will be either ASP.NET,Java or AngularJS. SelectboxIn below example we will bind select boxes to our application with the ng-model directive. And property define ng-model attribute will have the value of selected option from select box. Below selectbox we have 3 values ![]() In above example value of myTestVar will either be asp.net,java or angularJS One More ExampleIn below example we have tried some value on input box and have below facts (i)ng-app directive defines the AngularJS application. (ii)ng-controller directive defines the application controller. (iii)ng-model directive binds 2input elements to the user object in the model. (iv)myTestCtrl controller sets initial values to master object and we define reset() method. (v)reset() methods sets the user object EQUAL to the master object. (vi)ng-click directive invokes the reset() method when button is clicked.
|
|
| 12. |
Select Option |
|
Answer» Select Option |
|
| 13. |
AngularJS Tables |
|
Answer» AngularJS Tables |
|
| 14. |
Model Directive |
|
Answer» Model Directive |
|
| 15. |
Add a Directive |
|
Answer» Add a Directive |
|
| 16. |
Controller Basic |
|
Answer» Controller Basic |
|
| 17. |
Validate Inputs |
|
Answer» VALIDATE Inputs In ng-model we can also input some validation for APPLICATION DATA and this may have validation like Number, e-mail or required type. Below example will helps you to understand where we will put validation ![]() the span will be DISPLAYED only if the expression in the ng-show attribute returns TRUE. |
|
| 18. |
Data Binding |
|
Answer» Data Binding |
|
| 19. |
AngularJS Filters |
|
Answer» AngularJS Filters |
|
| 20. |
Root of Scope |
|
Answer» Root of Scope |
|
| 21. |
AngularJS Scope |
|
Answer» AngularJS Scope |
|
| 22. |
AngularJS Controller |
|
Answer» AngularJS Controller |
|
| 23. |
CSS Classes |
|
Answer» CSS CLASSES We can also apply some validation on CSS class here we will LEARN validation name "required" through that we will apply some validation on input control. ![]() The ng-model directive adds orremoves the following classes, according to the status of the form field: (i) ng-empty (ii) ng-not-empty (iii)ng-touched (iv) ng-untouched (v) ng-valid (vi) ng-invalid (vii)ng-dirty (VIII)ng-pending (IX) ng-pristine |
|
| 24. |
AngularJS Modules |
|
Answer» ANGULARJS MODULES Here we will KNOW what is AngularJS Modules and why we use and how we will use this. An AngularJS modules defines and application. There are many parts which are contains in module in application. Module also contains the application controllers. And Controllers always belong to a module. To create a module we use AngularJS function which is angular.module Now below example will define how to create a Module ![]() In above "myApp" parameter refers to an HTML element in which application will run. We can add Controllers, DIRECTIVES, filters and many more in AngularJS application. |
|
| 25. |
AngularJS JSON |
|
Answer» AngularJS JSON |
|
| 26. |
Angular CSS Properties |
|
Answer» ANGULAR CSS Properties Here we have produce one example to update or handle CSS properties through AngularJS. Here we have USE ng-init directive to initalize some values as GIVEN below example. Here we have take a example to change the COLUR of textbox through the code of AngularJS
|
|
| 27. |
AngularJS Expressions 2 |
|
Answer» AngularJS Expressions 2 |
|
| 28. |
Angular init Directive |
|
Answer» Angular init Directive |
|
| 29. |
AngularJS Introduction |
|
Answer» AngularJS Introduction |
|
| 30. |
Numbers And Strings |
|
Answer» Numbers And Strings |
|
| 31. |
Objects And Array |
|
Answer» OBJECTS And Array Both the Objects and Array are HANDLE in same as we will DONE in JavaScript. Below i have given 4 example 2 is for Objects and 2 is for Arrays. In both of these we use ng-init directives. Syntax of ANGULARJS Objects ![]() Syntax of AngularJS Objects with ng-bind ![]() Syntax of AngularJS Arrays ![]() Syntax of AngularJS Arrays with ng-bind
|
|
| 32. |
AngularJS VS JavaScript |
|
Answer» AngularJS VS JAVASCRIPT |
|
| 33. |
Controllers in Files |
|
Answer» Controllers in FILES |
|
| 34. |
Load the Library |
|
Answer» Load the Library |
|
| 35. |
AngularJS Tutorial |
|
Answer» AngularJS Tutorial |
|
| 36. |
AngularJS Applications |
|
Answer» AngularJS Applications |
|
| 37. |
AngularJS Expressions 1 |
|
Answer» AngularJS EXPRESSIONS 1 |
|