C# 无法使用敲除组件呈现部分html

C# 无法使用敲除组件呈现部分html,c#,knockout.js,C#,Knockout.js,我定义了如下组件 module AgeModule { export class My_Component { static componentName: string = 'mycomponent'; static templateName: string = My_Component.componentName + '-template'; myObs: KnockoutObservable<any>; constructor(params)

我定义了如下组件

module AgeModule {

export class My_Component {
    static componentName: string = 'mycomponent';
    static templateName: string = My_Component.componentName + '-template'; 
    myObs: KnockoutObservable<any>;

    constructor(params) {

        this.myObs = params && params.myObs;

    }
    static registerComponent = () => {
        ko.components.register(My_Component.componentName, { viewModel: My_Component, template: { element: My_Component.templateName } });
    }
}
并加载部分视图,如

  @Html.Partial("~/Areas/Views/Home/Partials/MyComponent.cshtml", Model)
然后在部分视图“MyComponent.cshtml”中


ksjsssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
我把组件称为

<mycomponent params="age: ageobs"></mycomponent>

我在控制台中没有得到任何类型的错误,但我的局部视图根本没有渲染。我也不知道如何调试。如何解决这个问题

更新

这在绑定组件时起作用

<div data-bind="component: {name: 'mycomponent', params: {age:ageobs}}">


</div>


但是如果您直接使用组件标记,则不起作用。

我认为组件名称必须与“MyComponent.cshtml”中的id匹配,因此请尝试更改
静态组件名称:string='MyComponent'
要成为
editShipping类型的商品
或id要成为
mycomponent模板

我发布问题时出错。名字是正确的。请参阅更新的问题我在typescript文件下设置了断点,但在注册组件时仅命中一次,但在被此代码调用时应再次命中。请发布如何初始化
My_组件
以及如何应用绑定?
ageobs
来自哪里?另外,我认为在
@Html.Partial(…)
<mycomponent params="age: ageobs"></mycomponent>
<div data-bind="component: {name: 'mycomponent', params: {age:ageobs}}">


</div>