javascript - Understanding the changes in angular.copy() between 1.0.7 to 1.2.26 -



javascript - Understanding the changes in angular.copy() between 1.0.7 to 1.2.26 -

hey angularjs wizards!

i'm trying implement similar next plnkr. original post.

http://plnkr.co/edit/mzqhgg?p=info

var projectsapp = angular.module('projects', ['ngresource']); projectsapp.config(function($routeprovider) { $routeprovider .when('/', { controller: 'projectlistctrl', templateurl: 'projectlist.html'}) .when('/project/:id', { controller: 'projectdetailctrl', templateurl: 'projectdetail.html' }) .otherwise('/'); }); projectsapp.factory('project', function($http) { var json = $http.get('project.json').then(function(response) { homecoming response.data; }); var project = function(data) { if (data) angular.copy(data, this); }; project.query = function() { homecoming json.then(function(data) { homecoming data.map(function(project) { homecoming new project(project); }); }) }; project.get = function(id) { homecoming json.then(function(data) { var result = null; angular.foreach(data, function(project) { if (project.id == id) result = new project(project); }); homecoming result; }) }; homecoming project; }); projectsapp.controller('projectlistctrl', function(project, $scope) { $scope.projects = project.query(); }); projectsapp.controller('projectdetailctrl', function(project, $routeparams, $scope) { $scope.project = $routeparams.id ? project.get($routeparams.id) : new project(); });

in example, works notice angularjs references 1.0.7 , not latest 1.2.26. 1 time update script reference 1.2.26, illustration breaks. believe issue on line 21 in app.js file angular.copy(data, this) called.

i'm still newbie angularjs. tried googling , failed figure out breaking changes between 1.0.7 , 1.2.26. found this , searched angular.copy(), don't understand ramifications related example. plus want understand better.

thanks in advance!

you have include angular routing js in code. because in latest version, routing separated general angular js script.

thanks, sandeep garg

javascript angularjs

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -