I try this solution
https://mcmap.net/q/99013/-how-to-create-separate-angularjs-controller-files
https://mcmap.net/q/1880129/-how-to-have-controllers-in-separate-file-in-angularjs
and then I got this error
GET http://localhost:8000/js/TaskController.js net::ERR_ABORTED 404 (Not Found)
Then I check this solution
https://github.com/angular/angular-cli/issues/8371
My problem: I have a Laravel & angular Application that works fine, But I want to make the App.js
file cleaner by separate the controllers to different files, I trying some solutions and I think they are not working for Laravel.
app.js
var app = angular.module('LaravelCRUD', []
, ['$httpProvider', function ($httpProvider) {
$httpProvider.defaults.headers.post['X-CSRF-TOKEN'] = $('meta[name=csrf-token]').attr('content');
}]);
app.controller('StudentController', ['$scope', '$http', function ($scope, $http) {
//Some code here that works fine
}]);
I also Update my app.blade.php
files like this
//somecodes
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>
<script src="{{ asset('js/TaskController.js') }}" defer></script>
//somecodes
I want to make a StudentController.js
file that contains this controller codes.
I use these versions
Angular CLI: 6.1.4
Node: 8.11.4
OS: win32 x64
Angular: undefined
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.7.4 (cli-only)
@angular-devkit/core 0.7.4 (cli-only)
@angular-devkit/schematics 0.7.4 (cli-only)
@schematics/angular 0.7.4 (cli-only)
@schematics/update 0.7.4 (cli-only)
rxjs 6.2.2 (cli-only)
webpack 3.12.0
and Laravel 5.7