2

I ran into a small problem.

I have a SPA application I'm writing in knockoutjs.

I'm using yeoman for the scaffolding.

There's a header and a footer which remains the same.

Each page content i.e. the viewmodel and html is located inside a directory which lies inside the components directory.

I have a dropdown component which I want to place inside another component. For some reason, it doesn't appear. The name of my component is period-dropdown.

The name of the file of my component is period-dropdown.js The name of the template (html) file of my component is period-dropdown.html Both resides in the same directory period-dropdown The period-dropdown resides inside the components directory

Here's the VM of my component:

define('period-dropdown', ['knockout', 'text!./period-dropdown.html'], function (ko, templateMarkup) {

function PeriodDropdown(params) {
}

return { viewModel: PeriodDropdown, template: templateMarkup };

});

Here is the way that component is registered:

 ko.components.register('period-dropdown', {require: 'components/period-dropdown/period-dropdown' });

I placed the html for that component inside my content page (which is also a component)

<period-dropdown></period-dropdown>

The period-dropdown component is not loaded and I get the error:

Uncaught Error: Load timeout for modules: components/period-dropdown/period-dropdown

What am I doing wrong?

thanks for the help

Ace
  • 831
  • 2
  • 8
  • 28
  • Have you seen this: http://stackoverflow.com/questions/14279962/require-js-error-load-timeout-for-modules-backbone-jquerymobile – David Tansey Dec 25 '15 at 21:00
  • No I haven't. I looked at it and changed the waitSeconds. Now I don't get the error but my component is still isn't loaded. – Ace Dec 25 '15 at 21:28
  • make sure that this componet was registered before the other tha uses this. – Joel R Michaliszen Dec 25 '15 at 22:49
  • Ok, I did it but I still don't see it. Do you need to see more info about my files? – Ace Dec 26 '15 at 09:10
  • What I see is that the files are download i.e. the JS for the VM and the html for the template but it's not connected to the page it's in. The code doesn't reaches the Ctr of the nested component. – Ace Dec 26 '15 at 09:42

1 Answers1

0

Ok, it's working right now. It lookes like the problem was that I set an "id" for my AMD module when there's already a registered id for that module in the startup js. BTW, it wasn't related to the order of the components registration. Hope it will help others who will encounter this issue.

Ace
  • 831
  • 2
  • 8
  • 28