ng-biscuit – cookies extension for AngularJS

ng-biscuit

If you work with AngularJS a lot you probably know that when you want to use cookies with all the options like domain, path, etc… you face with lack of functionality in native Angular ngCookies module. It’s almost 3 years when this issue has been reported.

So I’ve created my module – ng-biscuit to deal with cookie options.

There is also alternative by Dmitri Voronianski by name ngKookies which is port of jquery-cookie.

JavaScript for detecting browser language preference

Just not to forget:

[javascript]
var language = window.navigator.userLanguage || window.navigator.languages[0];
[/javascript]

and more crazy(but more trustful) way:

[javascript]
$.ajax({
url: "http://ajaxhttpheaders.appspot.com",
dataType: ‘jsonp’,
success: function(headers) {
var language = headers[‘Accept-Language’];
}
});
[/javascript]

Автоматизируем тестирование AngularJS с Protractor

О том как установить и запустить Protractor уже было в этом посте – Тестируем AngularJS используя Protractor. А сейчас мы сделаем фокус  на том, как мы можем интегрировать Protractor в нашу систему и подкючить к Grunt.

Continue reading

AngularJS Directive attribute binding options

This example explicitly shows the difference between directive attribute binding types. Let’s say you have directive:

[javascript]
function myDirective() {
return {
scope: {
x: ‘@’, // String, interpolated with {{ }}
y: ‘=’, // Expression
z: ‘&’ // Function
}
};
}
[/javascript]

it means that you will do such operations with attributes to pass the directive:

[javascript]
function MyDirectiveController($scope, $element, $attrs, $interpolate, $parse) {
$attrs.$observe(‘x’, function(value) {});
$interpolate($attrs.x)($scope);
$scope.$eval($attrs.y);
var fn = $parse($attrs.z);
$element.on(‘click’, function() {
fn($scope);
});
}
[/javascript]