在AngularJS中,可以使用以下几种方式将一个字符串分割成数组:
$scope.string = "Hello World";
$scope.array = $scope.string.split(' ');
console.log($scope.array);
// Output: ["Hello", "World"]
{{word}}
{{word}}
请注意,以上示例中的ng-init指令用于将字符串初始化为$scope变量,以便在HTML中使用。您可以根据自己的需求调整代码。