I have setup my API backend using Laravel 5 Here is a look.
Route::get('/', function()
{
return view('index');
});
Route::group(array('prefix' => 'api/v1'), function()
{
Route::resource('suppliers', 'AdvancedMode\SuppliersController', array('only' => array('index', 'store', 'show', 'update', 'destroy')));
Route::resource('statuscodes', 'AdvancedMode\EquipmentsStatusCodesController', array('Only' => array('index', 'store', 'show', 'update', 'destroy')));
Route::resource('projects', 'AdvancedMode\ProjectsController', array('Only' => array('index', 'store', 'show', 'update', 'destroy')));
Route::resource('platetypes', 'AdvancedMode\PlateTypesController', array('Only' => array('index', 'store', 'show', 'update', 'destroy')));
And I am using the /public folder for AngularJs things the folder structure
/public
/css
/js
/controllers
/directives
/packages
/services
app.js
/views
In my /views folder I have my index.php file
<!DOCTYPE html>
<html ng-app="sxroApp">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="../css/main.css">
</head>
<body ng-controller="dashCtrl">
<div class="container">
<div class="row" ng-view></div>
</div>
<script src="../../bower_components/angular/angular.js"></script>
<script src="../../bower_components/angular-route/angular-route.min.js"></script>
<script src="../../bower_components/angular-resource/angular-resource.min.js"></script>
<script src="../../assets/js/app.js"></script>
<script src="../../assets/js/controllers/AdvancedMode/dashboardController.js"></script>
</body>
</html>
Now here comes the problem as you can see I have ng-view in my index.php file and willing so to inject the view.
In my app.js file I have the following.
(function()
{
var app = angular.module('sxroApp',
[
'ngRoute',
'ngResource'
]);
app.config( function ($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
controller: "dashCtrl",
templateURL: "../assets/views/advanced/dashboard.html"
})
.when('/plates',{
controller: "plateCtrl",
templateURL: "../views/advanced/plates.html"
});
$locationProvider.html5Mode({
enabled: true,
requireBase: false
});
});
}());
Some how I can't get the view from the dashboard.html file.
Here is my dashboard controller
angular.module('sxroApp')
.controller('dashCtrl', function($scope)
{ $scope.message = 'This routing is working!';
});
and here is my dashboard.html file.
<div class="page-title" ng-controller="dashCtrl">
<h3>Dashboard</h3>
<div class="page-breadcrumb">
<ol class="breadcrumb">
<li><a href="#">Home</a></li>
<li class="active">Dashboard</li>
<h1>{{message}}</h1>
</ol>
</div>
</div>
Finally I have the structure in picture. filestructure
I am stuck with this the whole day! Please help!
The problem is I have no idea how to debug this. I am fairly new into Angular. Here is my console.log
Please someone tell me what I am doing wrong.
templateURL: "../views/advanced/dashboard.html"templateURL: "/views/advanced/dashboard.html"?