Skip to content

Commit 1a4dade

Browse files
author
Jad Joubran
committed
Version 1.3.0 - Sample API call + Demo on github pages
1 parent 8a239ff commit 1a4dade

File tree

9 files changed

+60
-13
lines changed

9 files changed

+60
-13
lines changed

angular/app/dashboard/dashboard.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,10 @@ <h1 class="md-display-1">Angular Material</h1>
4949
</md-content>
5050
</md-tab>
5151
</md-tabs>
52+
<br>
53+
<md-button class="md-raised md-primary" ng-click="sample_test()">Restangular API call</md-button>
54+
<br>
55+
<br>
56+
<div>{{sample_data}}</div>
5257
</md-content>
5358
</div>

angular/app/dashboard/dashboard.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
(function(){
22
"use strict";
33

4-
angular.module('app.controllers').controller('DashboardCtrl', function( $scope ){
4+
angular.module('app.controllers').controller('DashboardCtrl', function( $scope, Restangular ){
5+
6+
7+
$scope.sample_test = function(){
8+
$scope.sample_data = 'Loading..';
9+
Restangular.all('test').doGET('sample').then(function( response ){
10+
$scope.sample_data = response.data;
11+
});
12+
};
513

614
});
715

angular/config/restangular.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
angular.module('app.config').config( function(RestangularProvider) {
55
RestangularProvider
6-
.setBaseUrl('/api/1/')
6+
.setBaseUrl('/api/v1/')
77
.setDefaultHeaders({'X-CSRF-TOKEN': document.getElementById('csrf-token').value });
88
});
99

app/Http/Controllers/WelcomeController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,9 @@ public function index()
3333
return view('welcome');
3434
}
3535

36+
public function sample(){
37+
$data = ['sample', 'api', 'call', 'with', 'laravel', 'and', 'restangular'];
38+
return response()->api( $data );
39+
}
40+
3641
}

app/Http/routes.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@
1717
return view('index');
1818
});
1919

20-
Route::get('home', 'HomeController@index');
21-
2220
Route::controllers([
2321
'auth' => 'Auth\AuthController',
2422
'password' => 'Auth\PasswordController',
2523
]);
24+
25+
Route::group(['prefix' => 'api/v1/'], function(){
26+
27+
Route::get('test/sample', 'WelcomeController@sample');
28+
29+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.2.2",
2+
"version": "1.3.0",
33
"devDependencies": {
44
"gulp": "^3.8.8",
55
"laravel-elixir": "*",

public/js/app.js

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/views/app/dashboard/dashboard.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,10 @@ <h1 class="md-display-1">Angular Material</h1>
4949
</md-content>
5050
</md-tab>
5151
</md-tabs>
52+
<br>
53+
<md-button class="md-raised md-primary" ng-click="sample_test()">Restangular API call</md-button>
54+
<br>
55+
<br>
56+
<div>{{sample_data}}</div>
5257
</md-content>
5358
</div>

readme.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
11
## Laravel 5 Angular Material Starter
2-
> Version 1.2
2+
> Version 1.3
3+
4+
## Frontend Demo
5+
6+
[VIEW DEMO](https://jadjoubran.github.io/laravel5-angular-material-starter)
37

48
![Laravel & Angular](http://i.imgur.com/XiMykki.png)
59

10+
11+
## OVERVIEW
612
This is a starter project that gives you an out of the box configuration Laravel 5 and AngularJS (folder by feature architecture).
713
Here are the goodies that you'll get:
814

915
* Laravel5
1016
* [Laravel5 Debug Bar](https://github.com/barryvdh/laravel-debugbar)
1117
* Angular
1218
* Angular Material
13-
* Angular UI Router
19+
* [Angular UI router](https://github.com/angular-ui/ui-router) configuration with multiple views
1420
* EditorConfig
1521
* JavaScript Code Style (jscs)
1622
* Jshint
1723
* Less
1824
* Elixir (for all the above)
1925
* Angular Material sample code
20-
* [ui-router](https://github.com/angular-ui/ui-router) configuration with multiple views
26+
* Angular Material custom theming
27+
* Sample integration between Restangular & Laravel API endpoint
2128

2229

2330
## Installation
@@ -45,15 +52,20 @@ Open a new issue.
4552

4653
Here's what I'm planning for the next versions:
4754

48-
+ Add sample Laravel APIs and call them using Restangular
4955
+ Laravel login API fixes
56+
+ Add sample Layout which relies on flexbox
5057
+ Sample route authentication (via $localStorage)
5158
+ Gulp watch should not exit when it catches an error
52-
+ Host demo on github pages
5359
+ Installer script that does everything
5460

5561
## Changelog
5662

63+
### v1.3.0
64+
65+
+ Host demo on github pages
66+
+ Add sample Laravel APIs and call them using Restangular
67+
68+
5769
### v1.2.2
5870

5971
+ API response macro (to make API calls more compatible with Restangular)

0 commit comments

Comments
 (0)