Package Data | |
---|---|
Maintainer Username: | Moszkva |
Maintainer Contact: | szecsi44@freemail.hu (Gabor Szecsi (Moszkva)) |
Package Create Date: | 2014-03-17 |
Package Last Update: | 2014-03-29 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:19:04 |
Package Statistics | |
---|---|
Total Downloads: | 35 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 2 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Laravel-Angular routing manager. Generates angular routing rules from serverside routing rules and services.
https://packagist.org/packages/moszkva/angie
#Features#
##Installation##
Installation via composer
{
"require-dev": {
"moszkva/angie": "dev-master"
}
}
##Usage##
After installation you must register AngieServiceProvider in your config/app.php:
'providers' => array(....,
....,
'Moszkva\Angie\AngieServiceProvider'),
'aliases' => array(.....,
.....,
'Angie' => 'Moszkva\Angie\Facades\Angie'));
and you must register routing rules for angie:
// Angie BEGIN
Route::get('angie/get/routing', function()
{
return Angie::renderRouterProviderStatment('<YourAppName>', '/angie/test');
});
Route::get('angie/get/services', function()
{
return Angie::renderServices('<YourAppName>');
});
// Angie END
and you must place these in your index.html after each other angular scripts:
<!--Angie BEGIN-->
<script src="angie/get/routing"></script>
<script src="angie/get/services"></script>
<!--Angie END-->
##How works the angie?##
<YourAppName>.config(['$routeProvider',
function($routeProvider) {
$routeProvider
.when("/angie/test",{"controller":"AngieTestController","templateUrl":"angie/test"})
.when("/angie/test/create",{"controller":"AngieTestController","templateUrl":"angie/test/create"})
.when("/angie/test/:test",{"controller":"AngieTestController","templateUrl":"angie/test/' + $routeParams.test + '"})
.when("/angie/test/:test/edit",{"controller":"AngieTestController","templateUrl":"angie/test/' + $routeParams.test + '/edit"})
.when("//",{"controller":"TestController","templateUrl":"/"})
.otherwise({"redirectTo":"/angie/test"})}]);
var <YourAppName>Services= angular.module('<YourAppName>Services', ['ngResource']);
AngieTestControllerService.insert(properties);
AngieTestControllerService.update(properties);
AngieTestControllerService.delete(id);
AngieTestControllerService.show(id);
AngieTestControllerService.list(id, params); // params is optional.
Very important constraint for valid service generation:
Valid configuration (AnotherAngieTestController is subclass of AngieTestController):
Route::resource('angie/test', 'AngieTestController');
Route::resource('angie/test2', 'AnotherAngieTestController');
Invalid configuration:
Route::resource('angie/test', 'AngieTestController');
Route::resource('angie/test2', 'AngieTestController');
Namespace resolving:
Laravel route rule:
Route::resource('/test', 'Test\Angie\TestController')
Controller name in generated routprovider statement:
TestAngieTestController
Service name in generated service statement:
TestAngieTestControllerService