Skip to content

Instantly share code, notes, and snippets.

@asicfr
asicfr / gist:5013415
Created February 22, 2013 13:36
entite route
// author module add into global module (see mainctrl.js)
var bookStoreauthor = angular.module('bookStore.author', ['bookStore.author.services'], function($routeProvider, $locationProvider) {
// author list
$routeProvider.when('/author', {
templateUrl: 'gen/pages/author/list.html'
});
// author create
@asicfr
asicfr / gist:5013444
Created February 22, 2013 13:41
sous controleur et methodes du crud
// author Controllers
bookStoreauthor.controller('AuthorListCtrl', ['$scope', '$location', '$routeParams', '$rootScope', 'ApiAuthor', 'ApiStorage', function ($scope, $location, $routeParams, $rootScope, ApiAuthor, ApiStorage) {
$rootScope.logMe("AuthorListCtrl");
var self = this;
$scope.authors = ApiAuthor.search();
$rootScope.logMe("search end");
// new Author call
@asicfr
asicfr / gist:5013596
Created February 22, 2013 14:02
bookStoreauthor.controller
bookStoreauthor.controller('AuthorDetailCtrl', ['$scope', '$location', '$routeParams', '$rootScope', 'ApiAuthor', 'ApiStorage', function ($scope, $location, $routeParams, $rootScope, ApiAuthor, ApiStorage) {
$rootScope.logMe("AuthorDetailCtrl");
$scope.idCurrent = $routeParams.id;
$rootScope.logMe("get author ");
$scope.oneauthor = ApiAuthor.get($scope.idCurrent);
...
@asicfr
asicfr / gist:5013977
Created February 22, 2013 14:53
json data store
{
"entities": {
"author": {
"uuid1": {
"firstName": "prenom",
"id": "1",
"lastName": "nom"
},
"uuid2": {}
},
@asicfr
asicfr / gist:5014121
Created February 22, 2013 15:16
binding
<div id="authorCreate" data-ng-controller="AuthorCreateCtrl">
<h2>Author Create</h2>
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="id">id</label>
<div class="controls">
@asicfr
asicfr / gist:5033199
Created February 25, 2013 20:54
structure
+---webapp <===== la page index et le fichier appcache sont générés à la racine
+---cssext <===== css externes (bootstrap ...)
+---cssin <===== css propre à l'application
+---gen <===== tous les autres fichiers générés sont dans ce répertoire
¦ +---js <===== contrôleur principal de l'application
¦ +---jsmodules <===== fichiers javascript (contrôleur et service) pour chaque entité
¦ +---pages <===== pages html pour chaque entité
¦ +---partials <===== header et footer html
+---img <===== images de l'application (bootstrap)
+---jsext <===== librairies javascript externes (jquery, bootstrap ...)
package test;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import javax.script.Compilable;
import javax.script.CompiledScript;
import javax.script.Invocable;
/*
* http://techasite.blogspot.fr/
* @author asic
*/
print("begin javascript");
print("instanciate Java ArrayList from javascript");
var x = new java.util.ArrayList(4);
<div data-ng-controller="MainCtrl">
<h1>text: {{data.text}}</h1>
<input type="text" data-ng-model="data.text" />
<h2>nb update: {{data.cpt}}</h2>
<button type="button" data-ng-click="showData()">Show</button>
<h2>text: {{data.extData}}</h2>
</div>
var app = angular.module('myApp', []);
app.controller('MainCtrl', ['$scope', 'myService', function ($scope, myService) {
console.log('online');
$scope.data = myService.outData;
$scope.showData = function () {
myService.showData();
};
}]);