0
The following warnings are appearing on the console with Chrome:
"Uncaught Typeerror: $ is not a Function bootstrap.js:29"
"Syntaxerror: Unexpected token [ angular.js:12330"
Follows my code:
<!DOCTYPE html>
<html ng-app="fluxo">
<head>
<title>Fluxojoin</title>
<meta charset="utf8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"> </script>
<script type="text/javascript" src="js/angular-route.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-responsive.css">
<link rel="stylesheet" type="text/css" href="css/fj.css">
<script>
angular.module("fluxo", ["ngRoute"]);
angular.module("fluxo").config(function ($routeProvider) {
$routeProvider.when("/entradas", {
templateUrl: "views/entradas.html",
controller: "fluxoCtrl"
});
$routeProvider.when("/saidas", {
templateUrl: "views/saidas.html",
controller: "fluxoCtrl"
});
$routeProvider.otherwise({redirectTo: "/index"});
});
angular.module("fluxo").controller("fluxoCtrl", function ($scope, $http) {
var mostraTodasContasEntradas = function () {
$http.get("php/index.php").success(function (data){
});
}
mostraTodasContasEntradas();
});
</script>
</head>
<body ng-controller="fluxoCtrl">
<div ng-include="'views/links.html'"></div>
<div ng-view></div>
</body>
</html>
Regarding the
Uncaught TypeError: $ is not a function bootstrap.js:29
you have to import the jQuery too.– Lucas Fontes Gaspareto
I don’t think you need @devgaspa, because $routeProvider doesn’t require a definition of it for each case, so it doesn’t expect there to be a
$
rather a code native to the Angularjs, or in its case, a new condition of.when
. At least by the current structure, I believe that’s the problem– celsomtrindade
@Celsomtrindade but the
TypeError
is happening inside bootstrap.js– Lucas Fontes Gaspareto
But that’s probably it. Since bootstrap works more in conjunction with jquery, it should expect a function in jquery. But it has no function that is geared toward this. It must be just a "misunderstanding" between the codes. Because he called bootstrap.js but currently does no function for it. At least not in the example provided.
– celsomtrindade