Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Uncaught ReferenceError: app is not defined

1106277May 24 2016 — edited May 24 2016

Hi,

I am new to JET. I was working on a sample project but I am facing this error.

I have app.js in same level as that of main.js in my project

JS

   |------app.js

   |------main.js

I have included 'app' in main.js like this :

require(['ojs/ojcore',

    'jquery',

   'app',

    'knockout',

    'ojs/ojknockout',

    'ojs/ojbutton',

    'ojs/ojchart'],

        function (oj, ko, $) // this callback gets executed when all required modules are loaded

        {  

                     function FooterViewModel() {

                          ---------------------

                     }

                     function FooterNavModel(name, id, linkTarget) {

                         -----------------------

                     }

                     function HeaderViewModel() {

                         ---------------------

                     }

           

            var vm = new app.vModel();

            $(document).ready(function () {

                ko.applyBindings(new HeaderViewModel(), document.getElementById('headerWrapper'));

                ko.applyBindings(new FooterViewModel(), document.getElementById('footerWrapper'));

                ko.applyBindings(vm, document.getElementById('globalBody'));

            });     

        }         

);

And I have my app.js like this :

define(['ojs/ojcore', 'knockout', 'jquery'],

        function (oj, ko, $)

        {

          function viewModel() { 

                self.threeDValue = ko.observable('off');

                var pieSeries = [{name: "Series 1", items: [42]},

                                 {name: "Series 2", items: [55]},

                                 {name: "Series 3", items: [36]},

                                 {name: "Series 4", items: [10]},

                                 {name: "Series 5", items: [5]}];

                this.pieSeriesValue = ko.observableArray(pieSeries);

                function XYZ(event, data) {    

                                   ----------------------------------

                }; 

                function ABCD(event, data) {    

                                   ----------------------------------

                };

        }

       return {'vModel': viewModel};                                  

});

       

       

But when I try to run my project I get the above mentioned error "Uncaught ReferenceError: app is not defined".

What am I doing wrong here ??

Thanks !!

This post has been answered by 1106277 on May 24 2016
Jump to Answer
Comments
Post Details
Added on May 24 2016
1 comment
1,047 views