2014-12-06 275 views
1
obj = ['sha','abc','xyz] //javascript array 

function myclrt($scope) //this angular js function 
{ 
    $Scope.one = obj[0]; // obj[0] is not being assinged to scope.one 
} 

這不起作用。將javascript數組賦值給angularjs變量

+0

POSS錯字'$ Scope'? – Dinesh 2014-12-06 08:59:49

+0

我想將'sha'(viz obj [0])賦值給$ scope.one(這是angularjs變量) – 2014-12-06 09:10:01

+0

Typo,請嘗試'$ scope'而不是'$ Scope'。 – 2014-12-06 10:52:15

回答

1

試試這個: -

obj = ['sha','abc','xyz] //javascript array 
function myclrt($scope) //this angular js function 
{ 
    $scope.one = obj[0]; // Typo $Scope -> $scope 
}