getting the ng-object selected with ng-change

Instead of setting the ng-model to item.size.code, how about setting it to size: Then in your update() method, $scope.item will be set to the currently selected item. And whatever code needed item.size.code, can get that property via $scope.item.code. Fiddle. Update based on more info in comments: Use some other $scope property for your select ng-model then: Controller:

Angularjs ng-view does not work

The problem is incorrect usage of ng-app. Only declare ng-app once for your application, usually on the html element. Then declare other modules as dependencies of your main module. I put the ng-app declaration on the html tag and put your ng-routing in the app module, getting rid of the views module. http://plnkr.co/edit/btL2QMyHxhDLH7cxZ1YV You can … Read more

angular.element vs document.getElementById or jQuery selector with spin (busy) control

I’m using the “Angularised” version of the Spin control, as documented here: http://blog.xvitcoder.com/adding-a-weel-progress-indicator-to-your-angularjs-application/ One of the things I don’t like about the shown solution is the use of jQuery in the service that effectively attaches the spin control to the DOM element. I would prefer to use angular constructs to access the element. I’d also … Read more

Angular.js: How does $eval work and why is it different from vanilla eval?

$eval and $parse don’t evaluate JavaScript; they evaluate AngularJS expressions. The linked documentation explains the differences between expressions and JavaScript. Q: What exactly is $eval doing? Why does it need its own mini parsing language? From the docs: Expressions are JavaScript-like code snippets that are usually placed in bindings such as {{ expression }}. Expressions … Read more

AngularJS errors: Blocked loading resource from url not allowed by $sceDelegate policy

Issue #1 : The url you are trying to request from your app is not safe according to the AngularJS sceDelegatePolicy. To resolve it, you need to whitelist the url in your app using resourceUrlWhitelist method in $sceDelegateProvider as shown below : For a clear explanation and above example are from here Issue #2: The … Read more

AngularJS $watch vs $watchCollection: which is better for performance?

The $watchCollection() function is a sort-of mid-ground between the two $watch() configurations above. It’s more in-depth than the vanilla $watch() function; but, it’s not nearly as expensive as the deep-equality $watch() function. Like the $watch() function, the $watchCollection() works by comparing physical object references; however, unlike the $watch() function, the $watchCollection() goes one-level deep and performs an additional, shallow reference check of the top level items in the collection. … Read more

Bare minimum code for AngularJS Carousel

You can check out the bare minimum bootstrap carousel from the latest bootstrap site: http://getbootstrap.com/javascript/#carousel The next step is getting this into a bare minimum AngularJS directive, which as it turns out is really simple. Links Since Bootstrap requires jQuery for the carousel component, you’ll need the latest version of jQuery: https://code.jquery.com/jquery-2.1.4.js. Also add the necessary links … Read more