2015年12月16日 星期三

angularjs controller directive callback parameter


<body ng-app="myApp">

    <div ng-controller="testCtrl">
      <strong>Name: </strong>{{name}}<br>
        <a dirt-pass-fun callback="changename">
        </a>
    </div>

<script>
var myApp = angular.module('myApp',[]);

myApp.controller("testCtrl", function($scope) {
      this.nickname="ctrl1 nickname";
      $scope.name="ctrl1";
      $scope.modelOne = {
        foo: 'Pascal'
      };

    $scope.changename = function(t) {    
      $scope.name+=t;
    }

});
myApp.directive('dirtPassFun', function() {
  return {
      restrict: 'A',
      scope: {
          callback: '='
      },
      template: '<button ng-click="callback(\'i am man\')">Click</button>'
  };
});
</script>

</body>

2015年12月15日 星期二

ERROR: (gcloud.preview.app.deploy) unrecognized arguments: --promote


usage: gcloud preview app deploy  DEPLOYABLES [DEPLOYABLES ...] [optional flags]
ERROR: (gcloud.preview.app.deploy) unrecognized arguments: --promote





use:

gcloud preview app deploy app.yaml --promote --docker-build=remote

dont user:
gcloud preview app deploy app.yaml --promote

2015年12月1日 星期二

$http.post(uploadUrl, fd, {

})
.success(function(result1){

})

//////////////////////////////////////////////////////////////////////////////////////

 $http.get('/setuploadpath/'+buildingName)
.then(function(result2) {

            return $http.post("/upload", fd, {transformRequest: angular.identity,headers: {'Content-Type': undefined}});
})


//////////////////////////////////////////////////////////////////////////////////////

2者的 result ,

result2.data = result1

2015年11月27日 星期五

2015年11月26日 星期四

angularjs factory return problem null undefined




========== work =========

  factory.getInit = function(type,lable){
    var t=null;
    angular.forEach(factory.models[type], function(value, key) {
        if(value.lable == lable){
          t=value.init;
          console.log("getInit-value.init: "+t);
        }
    });
    return t;
  };

========== doesn't work =========


  factory.getInit = function(type,lable){
    angular.forEach(factory.models[type], function(value, key) {
        if(value.lable == lable){
          console.log("getInit-value.init: "+value.init);
          return value.init;
        }
    });
  };


2015年11月22日 星期日