Could not get any raw data while converting using .models canjs

With the new CanJS update, my Models stopped working and I dont know why.

This is what my code looks like:

    Module = can.Model.extend({
           findAll: 'GET ' + window.rootPath+'api/module'
    }, {});

    FormModule = can.Control.extend({}, {
    init: function (element, options) {
        var self = this;

        Module.findAll({}, function (data) {
            self.element.html(can.view('viewModulesResult', data));               
        },            
        function (data) {
            console.log(data);               
        });                 
    }        
    });

Since I'm starting with javascript, I'm not very good at it, so I have no idea of whats wrong. When I pass the mouse over console.log(data) in the Console, this message appears: "Could not get any raw data while converting using .models" Does anyone knows whats wrong?

Answers:

Answer

The return isn't an array. can.Model.parseModels should be used to convert the ajax responses into a data format useful to can.Model.models. Reference: http://canjs.com/docs/can.Model.parseModels.html

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.