我无法将list
我的数据导入angular.module('myApp', [])
.controller("myCtrl", function($scope) {
$scope.list = ["call naina", "eat food", "do less work", "take meds"];
$scope.a = false;
$scope.d = false;
$scope.k = false;
$scope.text = '';
$scope.change = function() {
$scope.a = !$scope.a;
};
$scope.changd = function() {
$scope.d = !$scope.d;
};
$scope.remove = function(x) {
$scope.list[x] = "";
};
$scope.add = function() {
$scope.list[0].push($scope.text);
$scope.k = true;
};
});
数组
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl" >
<input type=button value="add" ng-click="change()" />
<input type=button value="delete" ng-click="changd()" />
<div ng-show="!a && !d" ng-repeat="x in list">
{{x}}
</div>
<div ng-show="d && !a" ng-repeat="x in list">
<input type="checkbox" ng-click="remove($index)">{{x}}
</div>
<div ng-show="a && !d" >
<input type="text" ng-model="text" placeholder="enter the work" /> <input type=button value="add" ng-click="add()" />
<div ng-show="k" ng-repeat="x in list">{{x}}</div>
.
</div>
</div>
$fromDate = date('Y-m-d', strtotime('-3 months'));
$toDate = date('Y-m-d', strtotime('-1 day'));
$client = new Google_Client();
$client->setAuthConfigFile(base_path().'/client_id.json');
$client->setAccessToken($cust->user_token);
$client->addScope(Google_Service_Webmasters::WEBMASTERS_READONLY);
$webmaster = new Google_Service_Webmasters($client);
$url = $cust->console_url;
$options = [];
$search = new Google_Service_Webmasters_SearchAnalyticsQueryRequest;
$search->setStartDate( $fromDate );
$search->setEndDate( $toDate );
$search->setDimensions( ['date'] );
$search->setAggregationType( 'auto' );
$console = $webmaster->urlcrawlerrorscounts->query($url, $options)->getCountPerTypes();
dd($console);
答案 0 :(得分:2)
更改为$scope.list.push($scope.text);
你可以看看https://plnkr.co/edit/S4wCKnfLQXrWAixM2y9a?p=preview