animation,swift,replace,watch,completion
Knowing the duration of the animation, could use a NSTimer to call a method after the duration of the animation is completed. var nsTimerObject:NSTimer = NSTimer.scheduledTimerWithTimeInterval(timeInSeconds, target: self, selector: "methodToBeCalled", userInfo: nil, repeats: false) ...
After many hours and having squared eyes now, I managed to find a blog with a solution. Here is the blog: (1) . http://blog.omgmog.net/post/getting-started-with-using-sass-in-your-existing-website/ Long story short: I got it to work and to do what I want it to do! smile I went through the steps as mentioned in...
clojure,zookeeper,watch,stm,cap-theorem
This seems to be a limitation in the way ZooKeeper implements watches, not a limitation of the CAP theorem. There is an open feature request to add continuous watch to ZooKeeper: https://issues.apache.org/jira/browse/ZOOKEEPER-1416. etcd has a watch function that uses long polling. The limitation here which you need to account for...
android,android-studio,android-wear,watch,watch-face-api
You should use Canvas.save, Canvas.rotate and Canvas.restore. Imagine, that you always draw things in the same place, but the underlying canvas is being rotated, so you will draw in the right place. Consider the example from the Santa Tracker: for (int i = 0; i < mCloudBitmaps.length; i++) { canvas.save();...
You could manually get the interpolated values once with $parse or scope.$eval, and use one-time binding ({{::var}}) inside the template: .directive('inputNumber', function ($parse) { scope: {}, template: '<input type="number" min="{{::min}}" max="{{::max}}" ng-model="value"/>', link: function($scope, $element, $attrs){ $scope.min = $parse($attrs.min)($scope.$parent); $scope.max = $parse($attrs.max)($scope.$parent); // etc... } } The usage would be:...
Another option would be to put sharedInfo onto the scope. $scope.sharedInfo = sharedInfo; $scope.$watch('sharedInfo.getError()', function(newValue, oldValue) { ... }); ...
Support for passing in watch tasks to the gulp.watch API as an array requires gulp version 3.5 at minimum. The gulp.watch API accepts an array of tasks only in gulp version 3.5 and up. My local gulp was version 3.4. I updated gulp to latest 3.8 version and my watch...
Your watch function is the problem. Whenever you change $scope.x.height, it will detect that x has changed and trigger the watch once more. Either move that height property out of x and put it somewhere else, or ensure that the value won't be different no matter how many times you...
Can I suggest a different aproach? Use tools "inotifywait". See this link as reference: http://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes
angularjs,controller,directive,watch
That's because $watch is just watching the reference of scope.data.nodes, so no matter what you push or pop, the reference will not change. Instead of using $watch, you can use $watchCollection. It will detect the length of the array. scope.$watchCollection('data.nodes', function(){ return scope.render(scope.data, scope.query); }); ...
javascript,angularjs,counter,watch
In the $digest cycle your {{incrementCounter()}} causes {{counter}} to change which causes a new $digest cycle which causes another evaluation of {{incrementCounter()}} ad infinitum. Basically if you have a counter which is incremented every $digest cycle, you can't have that variable affect the result of any $watched expression. You'll need...
javascript,node.js,watch,assemble,nodemon
Since you want to accomplish using this with assemble, but without gulp, I recommend chokidar. npm install chokidar --save Now you can require chokidar like this: var chokidar = require('chokidar'); Then define a little helper that runs handler whenever something in a pattern changes: function watch(patterns, handler) { chokidar.watch(patterns, {...
Remove $scope from directive injection. Add as parameter in controller function....
javascript,angularjs,events,listener,watch
The $watch function is used to watch variables on the scope. Scope inheritance allows you to watch parent scope variables as well, so that is definitely the way to go for your use case. As you correctly said, $on is used to watch for events, which you can $broadcast to...
html,angularjs,element,directive,watch
You have a template in your directive, so everything inside it will be replaced by that <div> tag. It works fine if you remove the template. I made a codepen example of your code: http://codepen.io/argelius/pen/jEzQVJ angular.module('test', []) .directive('menufileupload', function () { return { restrict: "E", link: function(scope, elem, attrs) {...
javascript,build,coffeescript,watch
Cake is the option you are looking for, it is light and it does the job. here is the main script for compilation and watching. fs = require 'fs' {exec} = require 'child_process' appFiles = [ # omit src/ and .coffee to make the below lines a little shorter 'content/scripts/statusbar'...
I think this come from the fact you have two tasks default. I guess gulp ignore the first one (with gulp.watch) to only trigger the second one. Then you have dependencies with watch but seems like watch does not exist ? You can install gulp-watch locally, and include it in...
angularjs,angularjs-directive,watch,angularjs-watch
i have corrected it. for working fiddle <div ng-app="myapp"> <div ng-controller="TreeCtrl"> <input type="text" ng-model="userName"/> <button ng-click="changeValue()">Change</button> <tree name="name"> </tree> </div> </div> module.directive("tree", function($compile) { return { restrict: "E", transclude: true, scope: { name: '=' }, template:'<div>sample</div>', link : function(scope, elm, $attrs) { function update() { }; scope.$watch('name', function(newVal, oldVal) {...
Just continue reading, in next capture 15-11 they will tell the previous code doesn't work. If you load the directives.html file into the browser, the directive won’t keep the li elements up-to-date. If you look at the HTML elements in the DOM, you will see that the li elements don’t...
The problem is in this line: <span contenteditable ng-model="phone">{{ phone }}</span> Since the phones is an array of primitive values, ngRepeat will create a copy of each phone on a scope created by ngRepeat. Then your ngModel is bound to this copy so the original object isn't changed and this...
java,multithreading,nonblocking,executorservice,watch
As pointed out in the comments, the take() method doesn't block the thread execution until a new key is provided, but it uses a mechanism similar to the wait() method to put the thread to sleep. I also found this post where it's pointed out that the WatcherService exploit the...
Just use a loop: while : ; do free -m | grep buffers; sleep 1; done The colon is equivalent to true. Redirect to a file called time if you like: while : ; do free -m | grep buffers >> time; sleep 1; done ...
angularjs,asynchronous,watch,ng-show,ng-hide
Your code looks pretty incomprehensible to me. For example returning true from event observer doesn't do anything at all, AFAIK. Also, don't manually set class="ng-hide" when using ng-show on the same element. Anyway, if I understand it correctly, you just need to create a boolean property and set it after...
The watch utility executes commands with sh -c. So, if you want to execute a zsh function, you need to execute zsh explicitly. For instance, if your functions are defined in a /path/to/functions file, you can do: watch 'echo hello | zsh -c "source /path/to/functions; my_fun"' or watch 'zsh -c...
javascript,angularjs,directive,watch,angular-ngmodel
You could add a parent directive which will collect the dirty elements, and will add new element once it detects all of the other elements are dirty: Check this plunker. HTML: <div collect-input> <div class="form-group" ng-repeat="(i, name) in name_list track by $index"> <div class="row"> <div class="col-xs-12"> <input class="form-control" type="text" ng-model="data.name_list[i]"...
$scope.$watch takes a callback function (not the name of one). So, changing to this should work: var recalculateInfoBox = function () { console.log('in recalc'); $scope.infoBox.width = '100px'; }; $scope.$watch('scores', recalculateInfoBox, true); From the docs: $watch(watchExpression, listener, [objectEquality]); Registers a listener callback to be executed whenever the watchExpression changes. ...
I think I'm satisfied with the "newer" plugin. I was never able to get the watch to run multiple tasks from a registered task and maybe that makes sense though it would be a nice feature to pick and choose which tasks to watch. I'm simply running "watch" and it's...
javascript,angularjs,angularjs-directive,watch
You need to add function to $formatters pipiline (because your are changing model from controller, not from view - then $parsers work) and run it if model is dirty: myApp.directive('customValidator', function() { return { restrict: 'A', require: 'ngModel', link: function(scope, elem, attrs, ngModelCtrl) { ngModelCtrl.$parsers.unshift(function(value) { if (value) { ngModelCtrl.$setValidity(ngModelCtrl.$name,...
Use $q and $http calls array to make a single promise: angular.module('myApp').factory('getDataService', function ($q, $http, httpService) { var service = { getData: function () { var defer = $q.defer(); var callChain = []; callChain.push(httpService.getFilteredData(selectedValue)); callChain.push(httpService.getFilteredData2(selectedValue)); callChain.push(httpService.getData()); callChain.push(httpService.getData2()); callChain.push(httpService.getData3()); $q.all(callChain).then( function (results) { console.log(results); //Array of...
As it turns out - after investigating further - I didn't fully understand how $watch worked. http://angular-tips.com/blog/2013/08/watch-how-the-apply-runs-a-digest/ really helped shed some light on the situation. As it turns out - simply changing a variable that is being watched won't trigger a digest loop by itself. The reason $timeout worked was...
service,sensor,android-wear,watch
Check if you requested android.permission.BODY_SENSORS permission in your both mobile and wearable AndroidManifest. Also, look into the logcat of your wearable device and grep for android.permission.BODY_SENSORS....
c#,debugging,visual-studio-2013,pass-by-reference,watch
If I understand correctly, You can use the Make Object ID feature. All you have to do is give the object Id for f1 earlier at some point in debugging. Later you can inspect the f2-- if f2 points to the same f1 debugger will show you the object id...
android,android-wear,watch,android-sdk-tools,android-sdk-2.1
Android Wear watch faces need to be included within a Wearable app which is a separate apk that runs directly on the Android Wear device.
javascript,angularjs,angularjs-ng-repeat,watch,angular-directive
By default when comparing old value with new value andular will be checked for "reference" equality. But if you need to check for the value then you need to do like this, scope.$watch('ngModel', function (newVal, oldVal) { render(); },true); But the problem here is that angular will deep watch all...
This isn't a satisfactory answer for me, but I ended up trying out another gem that would handle preprocessing, guard-livereload, and though it itself didn't work, when I came back to try sass --watch sass properly monitored my stylesheets directory for changes (partials included) and subsequently recompiled build.scss. I'm not...
javascript,ajax,angularjs,watch
You have the angular two-way data binding so it should automatically update your ng-repeat when the model changes. I suggest the following 1) Remove RentalDate controller first. 2) Use $timeout, and on success of http use this $scope.$apply(function(){ $scope.listing = data; }); If that doesn't still automatically update, put the...
With watch fortune | cosway you are piping the output of watch fortune into cosway. Instead you want to watch the value of fortune piped to cosway so you should quote it so watch will get the whole command to execute as watch 'fortune | cosway' ...
As already mentioned, you need to use $apply: $apply() is used to execute an expression in angular from outside of the angular framework. (For example from browser DOM events, setTimeout, XHR or third party libraries). Because we are calling into the angular framework we need to perform proper scope life...
javascript,jquery,html,angularjs,watch
you can use ngModelOptions available in angular 1.3: <input type="text" ng-modal="form.name" placeholder="Enter NAME" ng-model-options="{ updateOn: 'default blur', debounce: {'default': 500, 'blur': 0} }"> now your model gets updated only after the input loses his focus or the user stops typing for 500ms....
For a better and more Angular way, you can use $watchCollection instead: $scope.$watchCollection('[box1, box2]',function(newValues,oldValues){ console.log('Box1: '+newValues[0]+', Box2: '+newValues[1]); $scope.answer = (parseInt(newValues[0]) + parseInt(newValues[1])/2; //(or replace 2 with newValues.length if you plan to add more models into watch and get an average of more;) }); ...
watch is good to watch a command output, but not to work on it. I would suggest using a loop, wich saves the output between iterations and check for diff. Somethink like this: last_output=$(tempfile) output=$(tempfile) while true; do who | egrep -i 'user1|user2|user3' > $output # check for new users...
I'd refrain from using $scope.$watch() and turn to a more efficient solution. You can use the e-ng-change directive to fire a function computing new value of $scope.editForm.split every time the billAmt value changes. It would look like this: <tr ng-repeat="expense in viewModel.expenses"> <td>{{expense.eid}}</td> <td><span editable-text="expense.billAmt" e-ng-model="editForm.billAmt" e-name="billAmt" e-form="rowform" e-ng-change="checkSplit();">{{expense.billAmt}}</span></td> <td><span...
angularjs,angularjs-scope,watch
There are two errors in the code. A the scope.$watch documentation says, the first argument can only be string or function. You are not supposed to pass variables, unless their value is one of these. Since you are watching changes in the object properties, the third argument to $watch should...
c++,visual-studio,debugging,watch
Maby this will help you: To open the QuickWatch dialog box with a variable added While in break mode, right-click a variable name in the source window name and choose QuickWatch. This automatically places the variable into the QuickWatch dialog box. Source...
First way, make watcher as you already did: $scope.$watch(function (){ return $scope.cpr; }, function (value){ var shortYear=parseInt(value.substr(4,2)); if (shortYear>50) $scope.age=1900+shortYear; else $scope.age=2000+shortYear; }); Second way, create scope function that will calculate it: $scope.getAge=function (){ var shortYear=parseInt($scope.cpr.substr(4,2)); if (shortYear>50) return 1900+shortYear; else return 2000+shortYear; } And use it: <input type="text" ng-model="cpr"...
If your structure is not too big, a deep watch would do the trick. http://teropa.info/blog/2014/01/26/the-three-watch-depths-of-angularjs.html If you are concerned about performance, and depending your scenario, you could evaluate doing something like: Having a parent/global isInvalid flag, whenever a flag is marked as invalid mark as well the global invalid, then...
From AngularJs docs function(scope): called with current scope as a parameter. So it does not change the behavior of your code. However this version prevents a capture of the $scope variable inside the callback : $scope.$watch(function(scope) { return scope.val; }, function(value){ }); ...
This behaviour is documented(scroll down to $watch section) The listener is called only when the value from the current watchExpression and the previous call to watchExpression are not equal (with the exception of the initial run). Inequality is determined according to reference inequality, strict comparison via the !== Javascript operator,...
javascript,gulp,watch,pm2,babeljs
First, you're not watching the right way. Then, you should keep things separated. That's how I'd do: var paths = { babel: './somedir' } //basic babel task gulp.task('babel', function() { return gulp.src(paths.babel) .pipe(babel()) .pipe(gulp.dest('./')) }) //see below for some links about programmatic pm2 gulp.task('pm2', function(cb) { pm2.connect(function() { pm2.restart('echo', function()...
I think as mentioned in the other answer ng-change is the way to go. You could also improve your function for finding the option with the use of ngFilter so you don't have to write a for loop. Please have a look at your updated demo below or in this...
Since oneObject refers to an object, changing it will also change other references to that object. You can solve this with a closure. (function(obj) { globalFunction(obj,id,newval); }(oneObject)) This way, each time you call globalFunction it will receive a unique copy of oneObject. You need to create a closure for the...
Based on Slaven Tomac’s answer, here's what I came up with. Basically: this uses a $watchCollection to detect when items are inserted or added on the collection. For each added item, it starts monitoring it. For each removed item, it stops monitoring it. It then informs a listener each time...
javascript,angularjs,input,max,watch
Try to bind the total field (totalWeight, totalMoment and CG) to a scope function. Index.html <table class="table table-striped"> .......... <tr> <td colspan=4 class="text-right" style="font-weight: bold;">Totals:</td> <td class="text-right">{{calculator.getTotalWeight() | number:0}}</td> <td></td> <td class="text-right">{{calculator.getTotalMoment() | number:0}}</td> </tr> <tr> <td colspan=5 class="text-right" style="font-weight: bold;">CG:</td> <td...
Instead of returning it in anonymous function, apply $watch directly on scope objects- $scope.$watch('userFormData.cpr', function (cprValue) { console.log(cprValue); //For at scriptet ikke skal faile første gang det bliver loadet //tjekker vi om medlemmet har skrevet noget i cpr feltet if (cprValue === undefined) { return false; } //Hent brugerens input...
angularjs,firebase,angularfire,watch
You can use the $getRecord to do it: console.log($scope.messages.$getRecord(data.key)); You can look through the api for arrays here: https://www.firebase.com/docs/web/libraries/angular/guide/synchronized-arrays.html...
android,clock,android-wear,watch
onTimeTick will be delivered to you in ambient mode. Look at the reference of WatchFaceService: Called periodically in ambient mode to update the time shown by the watch face. This method is called at least once per minute. In interactive mode you need to implement your own mechanism....
scope.$watch(function() { //some code which is not relevant in current context }); is a pattern that can be used to run code once per digest. It is equivalent to: scope.$watch(function(){ }, undefined); From the docs: If you want to be notified whenever $digest is called, you can register a watchExpression...
A $watch will only fire once during each angular $digest cycle! (If watching a property that is - the simplest scenario). The three changes you are making to foo are all occurring during the same cycle. And angular will compare the values before the cycle and after the cycle. For...
Because the changes to the scope aren't applied when you use setInterval. Use $interval instead. https://docs.angularjs.org/api/ng/service/$interval
Don't use watch. It creates a lot of overhead and headaches later. Only use when absolutely necessary. You should try to use a promise instead, and get your service to return a promise if possible. If you must provide a callback to your outward service (that cannot return a promise)...
javascript,angularjs,service,angularfire,watch
I think the issue is, assignment to ref is being done before the data of $scope.authData is set in $watch. Try to change your code to this: flickrApp.controller('tagsCtrl', ['$scope', '$rootScope', '$firebase', 'shared', function($scope, $rootScope, $firebase, shared) { $scope.tagsList = []; $scope.shared = shared; var ref,sync; $scope.$watch('shared.getAuth()', function(authData) { $scope.authData =...
javascript,angularjs,factory,watch
You had a wrong syntax. It should return the service variable MenuFactory.Control & also there is no need of true in the end as you don't have object to check object equality. Code $scope.$watch(function(){return MenuFactory.Control}, function(NewValue, OldValue){ console.log(NewValue + ' ' + OldValue); console.log(MenuFactory.Control); }); ...
android,android-wear,watch,ambient
To be notified of the Ambient mode changed, you have to use a DisplayListener. You can find the way to do that here
javascript,angularjs,angularjs-directive,watch,angular-ui-router
I was able to find a solution by making use of State Change Events of angular. Here is how I solved the problem: So far, I had been watching the $viewContentLoaded variable of the parent view, which wasnt of much help. I had to watch the $viewContentLoaded variable of the...