2013-07-12 35 views

回答

0

這是angular.js聲明的函數:

function hashKey(obj) { 
    var objType = typeof obj, 
     key; 

    if (objType == 'object' && obj !== null) { 
     if (typeof (key = obj.$$hashKey) == 'function') { 
      // must invoke on object to keep the right this 
      key = obj.$$hashKey(); 
     } else if (key === undefined) { 
      key = obj.$$hashKey = nextUid(); 
     } 
    } else { 
     key = obj; 
    } 

    return objType + ':' + key; 
}