| Server IP : 104.21.37.246 / Your IP : 104.23.243.32 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/2388321/root/proc/2388322/cwd/sharedjs/libraries/angular-chosen/1.4.0/example/ |
Upload File : |
angular.module('chosenExampleApp', ['localytics.directives'])
.config(['$parseProvider', ($parseProvider) ->
$parseProvider.unwrapPromises(true)
])
.controller('IndexCtrl', ['$scope', '$q', '$timeout', ($scope, $q, $timeout) ->
simulateAjax = (result) ->
deferred = $q.defer()
fn = -> deferred.resolve(result)
$timeout fn, 3000
deferred.promise
simulateAjax(['grooo', 'wowowowow', 'lakakalakakl', 'yadayada', 'insight', 'delve', 'synergy']).then (result) ->
$scope.optionsFromQuery = result
$scope.optionsFromQueryAsHash = do ->
result =
win: "Brilliant Escape"
fail: "Untimely Demise"
simulateAjax(result)
$scope.$watch 'emptyCollection', (empty) ->
$scope.emptyOptions = simulateAjax(if empty then [] else ['look', 'i', 'have', 'data'])
$scope.directiveOptions =
no_results_text: "SO SORRY"
$scope.myPets = ['cat']
$scope.pets =
cat: 'Cat'
dog: 'Dog'
hamster: 'Hamster'
$timeout ->
$scope.$apply -> $scope.myPets.push('hamster')
, 1000
$scope.disabled = true
])