Question: I'm building a Wordpress site which contains lots of heavy images. 
By loading the 'large' version of the images that wordpress generates I think I can minimize the page load instead of getting the full size of them. But on desktops I want the full sized images to be loaded instead of the 'large' sized ones.

I've used the following code to change the image source if the page is loaded on a desktop:

```
$('img').each(function() {
    var src = $(this).attr('src');
    $(this).attr('src', src.replace(/-1024x682(\.[^.]+)?$/, '$1'));
});

```

But since all pictures aren't 1024x682 in their 'large' resolution I need another solution to my problem. Is it possible to instead of replacing `-1024x682` in the image src, just remove the last 9 characters (before the file extension of course)?

Answer: 
You need to set ng-model="tzModel.name" in ui-select directive.

<https://github.com/angular-ui/ui-select/wiki/FAQs#ng-model-not-working-with-a-simple-variable-on-scope>

```
<timezone tz-model="foo" />

<ui-select theme="bootstrap" ng-model="tzModel.name" ...

```

<https://jsfiddle.net/XyUGE/264/>
I made changes to your fiddle, look at this, it is working -> [fiddle](https://jsfiddle.net/XyUGE/265/)

You have to make the following changes

in view.html

```
<div ng-app="MyApp" ng-controller="MyCtrl">
    {{foo.name}}<br />
    <timezone tz-model="foo" />
</div>

```

change the 3rd line to tz-model = "foo"

in controller.js

```
var myApp = angular.module('MyApp', ['ui.select','ngSanitize']);

myApp.controller('MyCtrl', function ($scope) {
    $scope.foo = {name:"Africa/Abidjan"};
});

myApp.directive('timezone', function () {
    return {
        restrict: 'AE',
        template: '<ui-select theme="bootstrap" ng-model="tzModel.name" style="min-width: 300px;"> <ui-select-match placeholder="Select a timezone in the list">{{$select.selected}}</ui-select-match> <ui-select-choices repeat="tz in timezones | filter: $select.search"> <div ng-bind-html="tz"></div> </ui-select-choices> </ui-select>',

        scope: {
            tzModel : '=',
        },
        link: function(scope) {
            scope.timezones = ["Africa/Abidjan", "UTC"];
        }
    };
});

```

According to the docs, you have to keep model as "tzModel.name" instead of "tzModel" .... Hope it helps