Intro - Server side Flashcards

(21 cards)

1
Q

How to inject a something in a razor page?

A

Via [Inject] annotation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to make more than one project to run in the solution?

A

By multiple startup projects in the visual studio IDE.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the different ways to bind data in Blazor?

A

One way (read only) and two way (read/write).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the default input components in blazor?

A

InputText, InputTextArea, InputNumber, InputSelect, InputDate and InputCheckbox.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a common way to create forms in blazor?

A

By creating an EditForm with a relation with the model. Then handle input with two-way binds with events to handle valid and invalid inputs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What’s navigation manager? How to add to the form?

A

It’s a class that can redirect the user to another pager. Can be added to the form by just adding the [Inject] NavigationManager class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How does validation in blazor works?

A

it’s similar to ASP.NET. Works via data annotations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to add validation to the shared lib where the model is defined?

A

By adding a nuget package system.componentmodel.annotations to the shared lib.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to add data validation to the blazor form?

A

By adding the element to the form. Also validationsummary to see validation errors. Also specific validations messages can be added to the input fields itself.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Can razor components be nested?

A

Yes. It’s normal and expected.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What happens to pages when it is composed by components?

A

It gets smaller and easy to use.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

On which folder the components are stored?

A

In the components folder.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Where to declare new common namespaces in the blazor project?

A

In the _Imports.razor file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the methods the components can overwrite?

A

OnInitialized, OnParametersSet and OnAfterRender. All these methods have their async extensions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Can we have a component folder in a different folder like a shared library?

A

Yes. It’s quite common. There is no need to have the folder inside the UI project.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When Blazor is no capable of noticing changes to the DOM, how to force it?

A

Calling StateHasChanged() method.

17
Q

How a component call tell the page or other component that data was added?

A

By creating an event that other components or the page can subscribe to.

18
Q

Where blazor run interoped javascript libs?

A

Always in the browser… even in server side blazor.

19
Q

What are the variants of the Blazor-javascript interop?

A

1 - .NET can call JavaScript;
2 - JavaScript call into .NET;
3 - The two items above can be wrapped into a library.

20
Q

How to inject javascript in the razor component? Is it included in blazor by default?

A

Yes, included by default.
[Inject]
public IJSRuntime JsRuntime {get; set;}

21
Q

What are the downsides of importing a javascript lib into blazor?

A

It’s necessary to add to add css and javascript in the host.css.