I am trying to make a web application. I have a task controller in a separate .js file which I include in the main .html file:
<head>
<script src = "tasks-controller.js"></script>
</head>
and the file tasks-controller.js:
tasksController = function() {
var taskPage;
var initialized = false;
return
{
init: function(page) {
if(!initialized)
{
.... some manipulation with jQuery...
initialized = true;
}
}
}
} ();
Back in my main .html file I call tasks controller right after body closing element:
<script>
$(document).ready(function()
{
tasksController.init($('#taskPage'));
}
</script>
When I test the file, in Google chrome tools, I get Uncaught SyntaxError: Unexpected token ( on line 8 of tasks-controller.js which is this line:
init: function(page)
along with another error that 'tasksController' is not defined when I call it above. Any suggestions to what I am doing wrong? Thanks!