This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-app="app"> | |
<div class='html-content'><p star-rating data-rate="two">2 comments</p></div></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("ProductUtils Service", function () { | |
var ProductUtils, | |
comments = [ | |
{ | |
"rate": 2, | |
"user": "Laurent Wroblewski", | |
"comment": "Test comment" | |
}, | |
{ | |
"rate": 4, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Service which handle all user logic. */ | |
var UserService = function ($http, $q, $log, $cookies, $cookieStore, isDebugMode) { | |
this.logUser = function (login, password) { | |
// We create a promise to offer the possibility to users to call some functions after the | |
// asynchronous call of $http.get. | |
var deferred = $q.defer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
"use strict"; | |
angular.module('app') | |
.controller('LoginController', ['$scope' , '$http', '$log', '$cookieStore', '$location', function ($scope, $http, $log, $cookieStore, $location) { | |
$scope.errorMsg = null; | |
$scope.logUser = function () { | |
$http.post('/api/login', {login: $scope.login, password: $scope.password}) | |
.success(function (user) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
"use strict"; | |
angular.module('app') | |
.factory('NewsService',['$resource', function ($resource) { | |
return $resource('/api/news/:op/:id',{id:'@id'},{ | |
like: {method:'GET',params: {op:'like'}}, | |
random: {method:'GET',params:{op:'random'}} | |
}); | |
}]); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.getImage = function (id) { | |
if (!id) { | |
return ""; | |
} else { | |
return "/img/catalog/" + id + ".jpg"; | |
} | |
}; | |
/** Returns rating for a given product. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form name="myForm"> | |
<h3>Training complaint form</h3> | |
<alert type="error" ng-if="myForm.txtContent.$error.maxlength"> | |
Complaint message must be five characters long or less! | |
</alert> | |
Your name: <input type="text" name="inputName" ng-model="complaint.name" ng-required="true" /> | |
Your mail: <input type="email" ng-required="true" name="inputMail" ng-model="complaint.mail" /> | |
Your complaint: <input type="text" name="txtContent" ng-maxlength="5" ng-model="complaint.content" /> | |
<button ng-disabled="!myForm.$valid" class="btn" ng-click="sendComplaint()">Send</button> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<div class="lateral-form"> | |
Results per page: <br/> | |
<!-- TODO: Number of products displayed per page. --> | |
<input type="number" id="nbFilter" name="nbFilter" ng-model="nbResults"/> Filter by name: | |
<br/> | |
<!-- TODO --> | |
<input type="text" id="nameFilter" name="nameFilter" ng-model="nameFilter.name"/> <br/> Order | |
by: <br/> | |
<!-- TODO --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-controller="FilterCtrl"> | |
Filter: <input type="text" ng-model="filterName"/> | |
/ Show <input type="text" ng-model="nbResults"/> results | |
<table> | |
<tr> | |
<th><a href="" ng-click="predicate='name'; reverse=!reverse">Name</a></th> | |
<th><a href="" ng-click="predicate='phone'; reverse=!reverse">Phone</a></th> | |
<th><a href="" ng-click="predicate='age'; reverse=!reverse">Age</a></th> | |
<th><a href="" ng-click="predicate='money'; reverse=!reverse">Money</a></th> | |
<th><a href="" ng-click="predicate='date'; reverse=!reverse">Birth Date</a></th> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
"use strict"; | |
angular.module('app').directive('productSummary', ['ProductUtils', function (ProductUtils) { | |
return { | |
restrict: 'E', | |
templateUrl: 'templates/partials/productSummary.html', | |
scope:{ |
NewerOlder