Git Product home page Git Product logo

Comments (9)

SteveSandersonMS avatar SteveSandersonMS commented on July 20, 2024 1

@guardrex The other errors are unrelated and can be ignored. Thanks for fixing this!

from blazor.docs.

ivryakhov avatar ivryakhov commented on July 20, 2024 1

I just have found probably another misprint on the page, section Component attributes.
@guardrex is it suitable to report this inside this issue? It looks like consistent.

Child component:

<div> ... </div>

@functions {
    public int Year { get; set; }
    public Action<int> ValueChanged { get; set; }
}

Actually, the second property's name should be YearChanged. In other case, there is a corresponding error message in a browser's console:

Uncaught (in promise) Error: System.InvalidOperationException: Object of type 'WebApplication1.Pages.ChildComponent' does not have a property matching the name 'YearChanged'.

from blazor.docs.

ivryakhov avatar ivryakhov commented on July 20, 2024 1

@guardrex thank you for the fix!

from blazor.docs.

guardrex avatar guardrex commented on July 20, 2024

Thanks @ivryakhov!

Yes, thank you for reporting ... I'll take a look at this in a couple of hours and get it fixed fast.

from blazor.docs.

guardrex avatar guardrex commented on July 20, 2024

Thanks again @ivryakhov for reporting. I fixed it in two spots (in the sample code and in the sample markup that explains the code).

@SteveSandersonMS I was surprised that it broke because I incorrectly assumed that ChildComponent.cshtml could have its RenderFragement property be named anything. Does the name of the property need to pair with the name of the component?

I understand the first pair ...

<ChildComponent ... /> 👉 ChildComponent.cshtml 👉 ChildContent RenderFragment

... is the second pair also a convention? If so, then I'll flesh that fact out more in the topic.

from blazor.docs.

SteveSandersonMS avatar SteveSandersonMS commented on July 20, 2024

The name of the parameter that receives child content is always ChildContent, regardless of the name of anything else. If people don't like this convention we might change it, but this is how it is today.

from blazor.docs.

guardrex avatar guardrex commented on July 20, 2024

The name of the parameter that receives child content is always ChildContent, regardless of the name of anything else.

Ahhhh! Ok ... I'll make that explicit in the topic. I'll ping u on the PR.

from blazor.docs.

ivryakhov avatar ivryakhov commented on July 20, 2024

Great! @guardrex thank you for the document update.

from blazor.docs.

guardrex avatar guardrex commented on July 20, 2024

@ivryakhov Great 👁️!

That came from the blog post: https://blogs.msdn.microsoft.com/webdev/2018/04/17/blazor-0-2-0-release-now-available/#binding-to-components

... and there is one line under the example that I didn't address in the topic example ...

The Value parameter is bindable because it has a companion ValueChanged event that matches the type of the Value parameter.

I've made a commit to the PR to change it to YearChanged. I also took Steve's line and added it to this section of the topic.

from blazor.docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.