Skip to content

Instantly share code, notes, and snippets.

View got5's full-sized avatar

Contribution To Tapestry 5 got5

View GitHub Profile
@got5
got5 / gist:d699b5a4362d057fe995
Last active August 29, 2015 14:11
Slide 23 - Two-Way Data Binding Magic
First name: <input type="text" id="txtFirstName" data-ng-model="user.firstName" />,
Last name: <input type="text" id="txtLastName" data-ng-model="user.lastName"/>
<button class="btn" id="btnReset" data-ng-click="user.firstName=' ';user.lastName=' ';">
Reset fields
</button>
<br/>
Hello, Mister <i id="lblName">{{user.firstName}} + {{user.lastName}}</i>
@got5
got5 / gist:a8fade483f338178dd7b
Last active August 29, 2015 14:11
Slide 29 - Expressions in AngularJS Part2
<table class="key-list" id="products" ng-init="product.price=50; product.qty=3">
<tr><td>Product name</td><td>Price</td><td>Qty</td><td>Total</td></tr>
<tr>
<td>AngularJS book for newbies</td>
<td id="price">{{product.price}}</td>
<td id="qty">{{product.qty}}</td>
<td id="total">{{product.price*product.qty}}</td>
</tr>
</table>
@got5
got5 / gist:a19fe6e66c3c9c927fad
Last active August 29, 2015 14:11
Slide 39 - Use of $watch by Angular
<div data-ng-controller="ProductController" id="productForm">
Name *: <input type="text" id="inputName" data-ng-model="product.name"/>,
Price *: <input type="number" id="inputPrice" data-ng-model="product.price"/> €,
Quantity *: <input type="number" id="inputQty" data-ng-model="product.qty"/>
<br/> <i id="errorMsg">{{mandatoryMsg}}</i>
</div>
@got5
got5 / gist:65a58721d7ac7a2b8db3
Last active August 29, 2015 14:11
Slide 46 - To conclude about controllers..
<div id="mainApp" ng-controller="MainCtrl">
Hello, {{currentUser.login}}
<tabset>
<tab heading="Mails" ng-controller="MailCtrl">
<div>You have {{nbMails}} mail(s) in your box.</div>
</tab>
<tab heading="Profile">
<div ng-controller="EditCtrl">
<input type="text" id="inputLogin" ng-model="tmpLogin"/>
<button class="btn" ng-click="editLogin()">Change login</button>
@got5
got5 / gist:e5eb8798533505f87329
Last active August 29, 2015 14:11
Slide 67 - Main Angular services: $http
<div id="userPanel" data-ng-controller="UserCtrl">
There are {{nbUsers}} connected users on the website.
</div>
@got5
got5 / gist:a9946e90610e6f588675
Created December 11, 2014 14:06
Slide 95 services_test_tp TP6
describe("ProductUtils Service", function () {
var ProductUtils,
comments = [
{
"rate": 2,
"user": "Laurent Wroblewski",
"comment": "Test comment"
},
{
"rate": 4,
@got5
got5 / ProductUtils UserService
Last active August 29, 2015 14:11
Slide 110 directives_use_tp TP7
.controller('CatalogController', ['$scope', '$location', 'catalogService','ProductUtils', 'UserService', function ($scope, $location, catalogService, ProductUtils, UserService) {
@got5
got5 / gist:ad8e4ccf9a5022509a7a
Created December 11, 2014 16:33
Slide 113 Native Angular Diecrtive
<div ng-controller="SurveyCtrl">
<h3>Survey application</h3>
<form name="formSurvey">
Name: <input ng-required="true" type="text"/><br/> <br/>
<div ng-repeat="category in categories">
{{category}}:
<span ng-repeat="note in notes">
{{note}}
<input type="radio" value="{{note}}" ng-model="survey[category]"
@got5
got5 / gist:378724ebc7fbf37628a0
Created December 12, 2014 16:51
Slide 125 - Using the scope property
<div ng-app="app">
<div class='html-content'><div ng-controller="ProductRatingCtrl">
<star-rating rating="{{productMarkCss}}">2 comments</star-rating>
Mark:
<select ng-options="mark for mark in marks" ng-model="productMark" />
</div></div></div>
@got5
got5 / gist:c93cecb0ed1f71a7ad67
Last active August 29, 2015 14:11
Slide 130 - Creating new directives
<div data-ng-app="app">
<div class='html-content'><div data-ng-init="login='Bob'">
<button class="btn" data-ng-click="login=''" data-confirm-click data-message="Are you sure ? ">Reset login</button>
Login: {{login}}
</div></div></div>