cgross / angular-owf

Angular service wrapper for the Ozone Widget Framework widget library
MIT License
0 stars 1 forks source link

Reference Error: OWF is not defined #3

Open Shanna7463 opened 9 years ago

Shanna7463 commented 9 years ago

I'm creating a new Ozone widget (simple Angular form) and I am getting this error when I try to use the angular-owf.

Here is my html:

    <!DOCTYPE html>
    <html owf-app="app">
<head>
<script src="js/lib/angular.min.js"></script>
<script src="js/lib/angular-resource.min.js"></script>
<script src="js/lib/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="js/lib/angular-owf.js"></script>
<script type="text/javascript" src="js/lib/owf-widget-min.js"></script>
<script type="text/javascript" src="js/lib/owf-widget-debug.js"></script>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
<script src="js/lib/bootstrap.min.js"></script>
<script src="js/app.js"></script>
</head>

<body>
<div ng-controller="MainCtrl">
    <form class="form-horizontal" ng-submit="newPost()">
        <fieldset>

            <!-- Form Name -->
            <legend>Form</legend>

            <!-- Text input-->
            <div class="form-group">
                <label class="col-sm-2 control-label" for="title">Name</label>
                <input ng-model="postData.name" id="title" name="name" type="text" class="col-sm-10 form-control">
            </div>

                             ...

Here is my app.js: var app = angular.module('app', ['ngResource', 'cgOwf']);

app.controller('MainCtrl', function ($scope, $timeout, Post, owf) {

console.log("Calling Subscribe");
owf.Eventing.subscribe('map.drawing.completed', function(sender, channelData){
        alert("Subscribe Received");
    });

$scope.posts = Post.query();

$scope.postData = {};
$scope.newPost = function() {
    var post = new Post($scope.postData);
    post.$save();
};

});

The console log never gets publish, and my subscribe is not working. The web console is displaying "Reference Error: OWF is not defined" Any ideas?

Thanks!

cgross commented 9 years ago

Move the owf widget javascript file up to the top of your script tags. Also I think you only need one of the owf-widget-min.js and owf-widget-debug.js.

Try moving the owf javascript file to the top of your script tags.