Sie können auf die angular js scope-Variablen zugreifen, indem Sie $scope.scopeVariableName
verwendenUm dies zu einem JavaScript-Variable von
var varibleName = $scope.scopeVariableName;
nur vergeben werden, wenn Sie Bereichsobjekte verwenden in UI (controllerAs Syntax), können wir dies mit this
Variable
var varibleName = this.scopeVariableName;
Beispiel zuordnen:
<div ng-controller="yourController">
{{scopeVariableName}}
</div>
Controller:
function yourControllerFunction($scope){
$scope.scopeVariableName = "Canada";
var variableName = $scope.scopeVariableName;
}
yourControllerFunction.$inject = ['$scope'];
angular.module('yourMainModule').controller('yourController', yourControllerFunction);
'var country = $ scope.country'? – Ofiris