Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

davorminchorov's avatar

Series: Building an app from scratch using Laravel and Angularjs!

Hey,

I recently started learning Laravel and want to extend my knowledge by adding Angularjs into the mix. I'd like to watch a series type of tutorial similar to Larabook where angularjs is used for the front end and laravel is used for the backend as API.

0 likes
12 replies
keevitaja's avatar

Yeah, still this lesson is more of a introduction than a tutorial.

Series should be on a small usable app or something... It doesn't have to be as comprehensive as LaraBook series or anything.

bostinait's avatar

Well I could mention another laravel/angularjs tutorial on another popular tutorial site but I fear I may be escorted off the premises :-)

davorminchorov's avatar

I saw that video and it's great but as keevitaja said, it's more of a introduction than a complete tutorial. I am looking for something bigger, with angular authentication, user roles, proper routing, different templates etc. with best practices (or a proper way to build an app). A little bit more of a real world app which is rare to find on other sites or youtube.

HRcc's avatar

@xuma What's the point? Andrew did a really good job with that course.

It's not that I don't like the idea of Laravel+Angular serie, but the thing is, that eventually Angular would do pretty much everything and Laravel part would provide just API (we already have stuff to cover that in API series). Is it still a suitable Laracasts material at that point?

ajschmaltz's avatar

I agree with @HRcc. The two don't "integrate". The two don't overlap except through the use of a RESTful API. So, you want to learn Laravel. Then, you want to learn Angular.

Roles, users, that's all done in Laravel the same as normal except your response is the object in JSON and not a view->with(); The routing is done with Restful principles in mind. There is no difference as far as I can tell with how you would handle users, roles, sessions, etc..

I'll tell you what I do most often (keep in mind I'm a total beginner): I usually just use Angular to do spiffy little things here and there. If I'm going to use it, I'll create a view like this:

filename: list.blade.php

<html ng-app="myApp">
    // template stuff
    @include ('angular.ngListCtrl')
    // template stuff
    // include Angular
</html>

filename: ngListCtrl.blade.php

<div ng-controller="ngListCtrl">
    <li ng-repeat="item in items">[[ item.title ]]</li>
</div>

filename: app.js

app = angular.module('myApp', []);

app.config(['$interpolateProvider', function ($interpolateProvider) {
    $interpolateProvider.startSymbol('[[');
    $interpolateProvider.endSymbol(']]');
}]);

app.controller('ngListCtrl', ['$http', '$scope', function($http, $scope) {

    $http.get('/api/lists')
        .success(function(data){
            $scope.items = data;
        });

}]);

filename ListController.php

class ListController() {

     /*
     * @Get("api/lists")
     */
    public function index(ListRepository $listRepository)
    {
        return $listRepository->all();
    }

}

filename EloquentListRepository.php

class EloquentListRepository implements ListRepository () {

    private $list;

    public function __construct(List $list) {
        $this->list = $list;
    }

    public function all()
    {
        $list->all();
    }

}

filename: ListRepository.php

interface ListRepository() {

    public function all();

}

And that's the basic idea...

4 likes
jimmck's avatar

I too am evaluating Angular. Great Idea for a series. Angular is a JS interface to a backend service provider. I have used Knockout.js to do similar things.

Please or to participate in this conversation.