Ext js Model validation is throwing Error
<p>I am trying to validate my model using record.getValidation()  <code>Uncaught TypeError: factory is not a function(…)</code></p>

<p>Below is my code and Ext js verison is 6.0.2</p>

<pre><code>Ext.define('Student', {
    extend: 'Ext.data.Model',
    idProperty: 'Id',
    fields: [{
            name: 'Id',
            type: 'int'
        },
        'firstName',
        'lastName'
    ],
    validators: {
        firstName: 'presence',
        lastName: {
            type: 'length',
            min: 2
        }
    }

});
var studentRecord = Ext.create('Student', {
    firstName: '',
    lastName: 'J'
});

var validation = studentRecord.getValidation();
</code></pre>

<p>the above line is causing error getting factory is not a function. Kindly help me .</p>