I have a file controller.js
and I need use in my HTML file but in the moment I make a GET request I have 404 not found.
I have no ideia why this happens. The directory is:
../resources/js/controller.js
../resources/templates/app.vm
HTML
<!DOCTYPE html>
<html ng-app="oknok">
<head lang="pt-br">
<meta charset="UTF-8"/>
<title>OKNOK Admin</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.min.js"></script>
<script src="../js/controller.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body ng-controller="controller">
<center>
<h1>Cadastro de veículos</h1>
<div class="col-xs-4">
<label for="nome">Nome:</label>
<input type="text" class="form-control" ng-model="nome"><br>
<label for="tipo">Tipo:</label>
<input type="text" class="form-control" ng-model="tipo"><br>
<button type="button" class="btn btn-success" ng-model="salvar" ng-click="salvar()">Salvar</button>
</div>
</center>
</body>
</html>
JS
var oknok = angular.module('oknok', []);
oknok.controller('controller', function ($scope, $http) {
console.log("1");
$scope.salvar = function () {
console.log("entrou");
$http.post("/veiculos", {
msg: "teste"
}).success(function(data, status, headers, config){
console.log("enviado com sucesso");
}).error(function(data, status, headers, config){
console.log("erro ao enviar");
});
};
});