0

This is my Sample code :

var array_03 = [{'name':'Kapila','age':30}];
var array_04 = [{'name':'Saman','age':30}];    
$scope.userName_03 = array_03[0]['name']; // Kapila
$scope.userName_04 = array_04[0]['name']; // Saman
angular.isArray(array_03); // true
angular.isArray(array_04); // true

array_04[0]['name'] == $scope.userName_03; // <-- Problem here     

$scope.userName_05 = array_04[0]['name']; // <-- Hope to get 'Kapila' But Result 'Saman'

I Hope to $scope.userName_05 as 'Kapila' But Result 'Saman'

array_04[0]['name'] == $scope.userName_03; // <-- Problem here

1 Answer 1

4
array_04[0]['name'] == $scope.userName_03; // <-- Problem here 

In this line use '=' instead of '==' You are assigning the value so it must be '=' (assignment operator)

Sign up to request clarification or add additional context in comments.

1 Comment

array_04[0]['name'] = $scope.userName_03; It's Working thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.