My code worked in Angular 1.2, but does not work in 1.3, and I cannot figure out what has changed in Angular and what I have to change in my code to fix it.
I installed the plunkr example .
HTML code is simple
{{ 'guy' | change }}
Javascript code:
angular.module('app').service('MyService', function( $timeout ){ var data = null; $timeout(function(){ data = 'this is data'; },2000); this.transform = function(){ return data; } }); angular.module('app').filter('change', function( MyService ){ return function(input){ return MyService.transform(); } });
The idea is that the result of the filter depends on the asynchronous response.
In Angular 1.2, the view is updated accordingly. In Angular 1.3, this is not the case.
To switch between Angular 1.2 and Angular 1.3, you need to change the route to Angular at the top of the HTML file. between
<script data-require=" angular.js@1.3.0 " data-semver="1.3.0" src="//code.angularjs.org/1.3.0/angular.js"></script>
and this one
<script data-require=" angular.js@1.2.0 " data-semver="1.2.0" src="//code.angularjs.org/1.2.0/angular.js"></script>
I also tried 1.3.1 - the same problem.
angularjs
guy mograbi
source share