I am following this link to Create a Web App with Oracle JET Instead of Movie, I have employee. If you have any other example of Rest service with JET I can use please let me know.
I have my own rest service exposed as below endpoints:
(supports post/put/get/delete)
http://localhost.:3000/api/employees/
http://localhost.:3000/api/employees/XXXXXXX
I am doing the following in my factory.js
define(['ojs/ojcore'], function(oj) {
var QuickStartFactory = {
resourceUrl: "http://localhost:3000/api/employees"
// Create a single movie instance.
createEmployeeModel: function() {
var Employee = oj.Model.extend({urlRoot: this.resourceUrl,
idAttribute: "_id"});
return new Employee();
},
// Create a movie collection.
createEmployeeCollection: function() {
var Employees = oj.Collection.extend({url: this.resourceUrl,
model: this.createEmployeeModel()});
return new Employees();
}
}
return QuickStartFactory;
});
I have the below in employees.js
define(['ojs/ojcore', 'knockout', 'QuickStartFactory', 'ojs/ojmodel', 'ojs/ojcollectiontabledatasource', 'ojs/ojtable', 'ojs/ojbutton'],
function(oj, ko, QuickStartFactory) {
var viewModel = {
employeeCollection: QuickStartFactory.createEmployeeCollection(),
dataSource: ko.observable(),
// Called each time the view is shown to the user.
initialize: function() {
this.dataSource(new oj.CollectionTableDataSource(this.employeeCollection));
this.employeeCollection.fetch();
console.log()
},
....
I am getting below error and the UI is stuck saying "fetching data"
Uncaught (in promise) SyntaxError: Unable to parse bindings.
Bindings value: text: $data.firstName ? firstName : '
Message: Unexpected token ILLEGAL (08:35:04:143 | error, javascript)