Sie sind auf Seite 1von 4

1.

How does Angular 4 improved error handling, when an error is caused by something in a
template?
Ans. By Creating flattened versions of Angular module.
2. The . . . . . decorator allows us to define the pipe name that is globally available for use in any
template in the across application.
Ans. Pipe
3. Observables help you manage . . . . . . . . data.
Ans.asynchronous
4. Where would you put observables.
Ans. In the injectable decorator
5. How would you display a list of Employees on a webpage along with where they were in the list?
Ans. Loop through and print the index and the employee.
6. If you chain multiple pipes together, they are executed
Ans. In the order in which you specify them.
7. We can subscribe to an observable using the . . . . . . . . The benefit of this is that Angular deals
with your subscription during the lifecycle of a component. Angular will automatically subscribe
and unsubscribe for you.
Ans. Async pipe
8. The number pipe is location sensitive, which means that the same format argument will produce
differently formatted results based on the . . . . . . .
Ans.user’s locale setting.
9. How would you retrieve a list of items from a server's URL?
Ans.Create a Url Transaction
10. Types of pipe in Angular ?
Ans. DatePipe, UpperCasePipe, LowerCasePipe, CurrencyPipe, and PercentPipe
11. Parameterizing a pipe ?
Ans.A pipe can accept any number of optional parameters to fine-tune its output. To add
parameters to a pipe, follow the pipe name with a colon ( : ) and then the parameter value (such
as currency:'EUR'). If the pipe accepts multiple parameters, separate the values with colons
(such as slice:1:5)
12. Chaining the pipes ?
Ans.You can chain pipes together in potentially useful combinations. Eg. {{ birthday |
date | uppercase}}
13. Custom Pipe ?
Ans.import { Pipe, PipeTransform } from '@angular/core';
14. The transform method is essential to a pipe. The PipeTransform interface defines that
method and guides both tooling and the compiler.
15. Using ng command, how do you create an Angular 4 application named my-app?
Ans. ng create my-app --ng4
16. Angular 4 has made multiple performance improvements in its recent releases. One among
them is for routers where it no longer creates a new serializer every time UrlTree.toString is
called. What do you think is the reason behind this?
Ans.
17. You are developing an angular 4 application having an AppModule. You want to list the
components you have created for your application to tell angular which of them belong to
AppModule. In which of the following array so the AppModule will you list these components to
do so.
Ans. Declarations
18. TestBed.configureTestingModule({ providers : [FlexSearchService,HttpClientModule]}); //This
line is buggy? Which of the following is the correct version?
Ans.
TestBed.configureTestingModule({import:[HttpClientModule],providers[FlexSearchService]});
19. A components template contains the given snippet , what purpose does the directive
ngComponentOutlet serve?
<ng-container *ngComponentOutlet=”con”></ng-container>
Ans.Dynamic component injection.
20. Route is mapping of Path to a component.
21. Router Outlet is the place to display the component when the corresponding route becomes
active.
<router-outlet></router-outlet>
This is directive and defined in the RouterModule. When angular sees this angular its going to
render component associated with current route after this router outlet, its not going to render
inside the router outlet.
22. import {RouterModule} from ‘@angular/router’
23. forRoot() is a static method defined in the RouterModule class, and we use this to define root
routes for our application.
As application grows, it can be broken into smaller manageable modules, each module is going
to have a set of route for that particular area of application, in this case instead of using
forRoot() we will forChild() method.
24. forRoot() takes an array of routes, each route is an object with two properties: path,component.
forRoot([
{path:’’, component: HomeComponent},
{path:’followers’, component: GitHubComponentFollowers},
{path:’followers’, component: GitHubComponentFollowers},
{path:’followers/:id/:username’, component: GitHubFollowersComponent},
{path:’profile/:username’, component: GitHubProfileComponent},
{path:;’posts’, component: PostsComponent},
{path:’**’, component: NotFoundComponent}
])
25. RouterLink : directive defined in router module.
Traditional way : <a href=”/posts”>Posts</a> //This cause re-download of app application
resources, as app is reinitialized.
Using Router Link : <a routerLink=”/posts”>Posts</a> //This cause download content of only
target page.
Dynamic Links : <a [routerLink] = “[‘followers’,follower.id]” ></a>
MultipleParameters : <a [routerlink] = “[‘followers’,follower.id,follower.username]”></a>
26. RouterLinkActive :
In Navigation bar we need to set RouteLinkActive
Eg. <li routerLinkActive=”active current”><a routerLink=”/posts”>Posts</a></li>
This will dynamically set the css class when the link is active.
27. Getting the Route Parameters:
import { ActivateRoute } from ‘@angular/router’;
28. Which of the following directive bootstraps AngularJS framework?
ng-app
29. Which of the following statements are true?
Expression cannot contain condition, loop or RegEx
Expression cannot declare a function
Expression cannot contain comma, void or return keyword
All of the above *********’
30. AngularJS directives can be written in HTML element as:
Tag
Attribute
Class name
All of the above ************
31. What is $scope?
It transfers data between a controller and view
32. The ng-change directive must be used with ng-model directives.
True
33. Which of the following directive allows us to use form?
ng-form
34. What is service in AngularJS? Service is a reusable JavaScript function.
35. AngularJS filters ___________. Format the data without changing original data
36. AngularJS module can be created using ________. angular.module();
37. Which of the following statements are true?
AngularJS controller maintains application data & behaviour using $scope
AngularJS controller can be created in separate JS file
AngularJS controller can be added into module
All of the above********
38. Which of the following service is used to retrieve or submit data to the remote server? $http
39. Which of the following service is used to handle uncaught exceptions in AngularJS?
$exceptionHandler
40. Which of the following module is required for routing? angular-route.js
41. Which of the following provider can be used to configure routes? $routeProvider
42. Which of the followings are validation directives?
ng-required
ng-minlength
ng-pattern
All of the above *****
43. Which of the following is validation css class in AngularJS
ng-valid
ng-invalid
ng-pristine
All of the above ******
44.

Das könnte Ihnen auch gefallen