Knockout Component and RequireJs Content Not Found under Asp MVC

194 views Asked by At

I am trying to use components binding way with KnockoutJs and RequireJs, but I got simple issue that I can't solve.

I have created a folder under my Asp MVC 4 solution /SomeName/SomeSubName and I have created 2 files under this folder: mycmt.js and mycmt.html

In my cshtml I added the following html:

<RefEditorWindow params="value: someMyProp"></RefEditorWindow>

JS code part

ko.components.register('RefEditorWindow', {
            viewModel: { require: 'SomeName/SomeSubName/mycmt' },
            template: { require: 'text!SomeName/SomeSubName/mycmt.html' }
        });

inside of mycmt.js

define(['knockout'], function (ko) {

    function RefEditorWindowViewModel(params) {
        this.updatedDepartment = params.value;
    }

    return RefEditorWindowViewModel;    
});

I don't see any errors in console but on binding logic, I tried to show this component and see an error:

Content not found

How to fix it? Why required can't load or find files.

0

There are 0 answers