---------------------------------------------------------------------------------------
'use strict';
myApp.controller('First', ['$scope', 'Users', 'Assign', function($scope, Users, Assign){
Users.users(function(results){
$scope.users = results;
});
$scope.fn = function(id, n1){
$scope.n1 = n1;
$
scope.id = id;
}
$scope.ln = function(){
Assign.assign(function(results){
$
scope.work = results;
});
}
}]).controller('Second', ['$scope', 'Users', 'Lang', function($scope, Users, Lang){
Lang.langs(function(results){
$scope.lang = results;
});
Users.users(function(results){
$scope.users = results;
});
$scope.fn = function(id, n1){
$scope.n1 = n1;
$
scope.id = id;
}
}]);
---------------------------------------------------------------------------------------------------------------------
I changed above code to:
---------------------------------------------------------------------------------------------------------------------
(function() {
'use strict';
myApp.controller('First', ['$scope', 'Assign', 'separate', function($scope, Assign, separate){
$scope.ln = function(){
Assign.assign(function(results){
$
scope.work = results;
});
}
}]).controller('Second', ['$scope', 'Lang', 'separate', function($scope,Lang, separate){
Lang.langs(function(results){
$scope.lang = results;
});
}]);
function separate($scope) {
Users.users(function(results){
$scope.users = results;
});
$scope.fn = function(id, n1){
$scope.n1 = n1;
$
scope.id = id;
}
}
})();
---------------------------------------------------------------------------------------------------------------------
I got errors with above code. I played around to make global scope. assigning
this variable to a local variable etc. But couldn't make it work.
Any input on solving above problem will be very helpful.
Thanks @
Sander Elias and @Nicholas Smith
[Am reading style-guide and trying my best to understand it.]