AngularJS Upgrade (1.5 to 1.6,1.7) Makes directive scope bindings undefined

The AngularJS team recommends that controller code that depends on scope bindings be moved into an $onInit function. function LayoutController($scope, LayoutDTO, LayoutPreviewDTO) { var self = this; this.$onInit = function () { // bindings will always be available here // regardless of the value of `preAssignBindingsEnabled`. self.layoutDTO = LayoutDTO; self.layoutPreviewDTO = LayoutPreviewDTO; var test = … Read more

AngularJS All slashes in URL changed to %2F

%2F is the percent-encoding for the forward-slash / character. This problem is related to the fact that AngularJS 1.6 has changed the default for hash-bang urls in the $location service. To revert to the previous behavior: appModule.config([‘$locationProvider’, function($locationProvider) { $locationProvider.hashPrefix(”); }]); For more information, see SO: angularjs 1.6.0 (latest now) routes not working.

Error with $http.get in angularJS — Success not a Function [duplicate]

The .success and .error methods are deprecated and have been removed from AngularJS 1.6. Use the standard .then method instead. $http.get(‘https://api.github.com/users’) .then(function (response) { var data = response.data; var status = response.status; var statusText = response.statusText; var headers = response.headers; var config = response.config; $scope.user = data; console.log(data); }); Deprecation Notice The $http legacy promise … Read more

angularjs 1.6.0 (latest now) routes not working

Simply use hashbang #! in the href: <a href=”#!/add-quote”>Add Quote</a> Due to aa077e8, the default hash-prefix used for $location hash-bang URLs has changed from the empty string (”) to the bang (‘!’). If you actually want to have no hash-prefix, then you can restore the previous behavior by adding a configuration block to your application: … Read more

Why are AngularJS $http success/error methods deprecated? Removed from v1.6?

The problem was that .success and .error methods are not chainable because they ignore return values. This caused problems for people familiar with chaining and encouraged poor code from people unfamiliar with chaining. Witness all the examples on StackOverflow that use the deferred anti-pattern. To quote one of the AngularJS team: IMO .success and .error … Read more