(function() {
	"use strict";
	var app = angular.module('RbsChangeApp');

	function rbsShippingFeesEvaluation($http, $sce) {
		return {
			restrict: 'A',
			templateUrl: 'Theme/Rbs/Base/Rbs_Commerce/shipping-fees-evaluation.twig',
			replace: false,
			scope: false,

			link: function(scope, elm, attrs) {
				scope.displayPrices = attrs.hasOwnProperty('displayPrices');
				scope.displayPricesWithTax = attrs.hasOwnProperty('displayPricesWithTax');
				scope.data = null;
				scope.currentCountry = null;
				scope.currentShippingModes = [];

				$http.post('Action/Rbs/Commerce/GetShippingFeesEvaluation', {refresh: false})
					.success(function(data) {
						scope.data = data;
						if (scope.data.length == 0)
						{
							scope.data = null;
						}
						if (scope.data.countriesCount == 1){
							scope.currentCountry = scope.data.countries[0].code;
						}
					})
					.error(function(data, status, headers) {
						console.log('GetShippingFeesEvaluation error', data, status, headers);
						scope.data = null;
					}
				);

				scope.$watch('currentCountry', function(){
					scope.currentShippingModes = [];
					if (scope.currentCountry != null)
					{
						for (var i = 0; i < scope.data.shippingModes.length; i++)
						{
							if (scope.data.shippingModes[i].countries.hasOwnProperty(scope.currentCountry))
							{
								scope.currentShippingModes.push(scope.data.shippingModes[i]);
							}
						}
					}
				});

				scope.trustHtml = function(html) {
					return $sce.trustAsHtml(html);
				};
			}
		}
	}

	rbsShippingFeesEvaluation.$inject = ['$http', '$sce'];
	app.directive('rbsShippingFeesEvaluation', rbsShippingFeesEvaluation);
})();


@@ -22,16 +22,17 @@
 trict%22;%0A
+%0A
 %09var app
@@ -709,23 +709,17 @@
 th == 0)
-%0A%09%09%09%09%09%09
+ 
 %7B%0A%09%09%09%09%09%09
@@ -758,32 +758,46 @@
 %09%09if (scope.data
+ && scope.data
 .countriesCount 
@@ -801,16 +801,17 @@
 nt == 1)
+ 
 %7B%0A%09%09%09%09%09%09
@@ -1088,16 +1088,17 @@
 nction()
+ 
 %7B%0A%09%09%09%09%09s
@@ -1167,22 +1167,17 @@
 != null)
-%0A%09%09%09%09%09
+ 
 %7B%0A%09%09%09%09%09%09
@@ -1233,23 +1233,17 @@
 th; i++)
-%0A%09%09%09%09%09%09
+ 
 %7B%0A%09%09%09%09%09%09
@@ -1322,24 +1322,17 @@
 ountry))
-%0A%09%09%09%09%09%09%09
+ 
 %7B%0A%09%09%09%09%09%09
@@ -1656,10 +1656,8 @@
 );%0A%7D)();
-%0A%0A

Fix JS error.