javascript - jQuery in an Angular Controller: $(...).overhang is not a function -


so i'm attempting implement overhang.js application because alert messages has.

seemed simple task @ first... had (i thought) replace line in controller,

alert("an http request has been sent server.\nnow updating daycaredb.db!"); 

with

$("body").overhang({ type: "success", message: "an http request has been sent server.\nnow updating daycaredb.db!" }); 

and that'd that. unfortunately when attempt execute function , reaches $("body".overhang({ line, nothing happens , chrome console spits out "typeerror: jquery(...).overhang not function" , bunch of other stuff.

how fix this?

here full function:

$scope.refreshdatabase = function() {     $http.get('/refreshdatabase')     .then(function(response) {         // alert("an http request has been sent server.\nnow updating daycaredb.db!");         $("body").overhang({         type: "success",         message: "an http request has been sent server.\nnow updating daycaredb.db!"         });         // location.reload();     }); 

i feel i'm doing silly or missing causing controller not use jquery properly.

edit:

this how head angular , jquery , stuff being included:

<head> <title>waiting list</title> <script type="text/javascript"></script> <!--overhang.js--> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> <link rel="stylesheet" type="text/css" href="./node_modules/overhang/dist/overhang.min.css" /> <script type="text/javascript" src="./node_modules/overhang/dist/overhang.min.js"></script> <!--angularjs--> <script src="./angular/angular-1.5.8/angular-1.5.8/angular.min.js"></script> <script src="./app.js"></script> <script src="./source/client/controllers/waitinglistcontroller.js"></script> <!--font awesome--> <link rel="stylesheet" type="text/css" href="./other files/(css stuff) font-awesome-4.7.0/font-awesome-4.7.0/css/font-awesome.min.css"> <!--foundation css--> <link rel="stylesheet" href="./other files/foundation-6.3.0-complete/css/foundation.css"> <link rel="stylesheet" href="./other files/foundation-6.3.0-complete/css/app.css"> </head> 

also full error message chrome console:

typeerror: $(...).overhang not function @ waitinglistcontroller.js:13 @ angular.js:16383 @ m.$eval (angular.js:17682) @ m.$digest (angular.js:17495) @ m.$apply (angular.js:17790) @ l (angular.js:11831) @ j (angular.js:12033) @ xmlhttprequest.t.onload (angular.js:11966) 

i guess have included jquery after angularjs.if so, swap them. remember use jquery in angularjs, need include before angularjs.

here correct hierarchy

    <script src="path/jquery"></script>   <script src="path/overhang.js"></script>     <script src="path/angular"></script> 

Comments