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)

    1
    • array_04[0]['name'] = $scope.userName_03; It's Working thanksCommentedSep 2, 2015 at 9:35

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.