361 |
doesn't work
work
from:
http://stackoverflow.com/questions/17039926/adding-parameter-to-ng-click-function-inside-ng-repeat-doesnt-seem-to-work |
2015年11月27日 星期五
ng-click angularjs parameters problem
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日 星期日
wordpress The requested document was not found on this server.
problem fix my changing file attributes to writable
mysql GREAT data base superuser
# mysql -u SUPERUSER -p
GRANT ALL PRIVILEGES ON * . * TO 'USER1'@'localhost';
# mysql -u USER1 -p
mysql> create Database NEWDB;
2015年11月19日 星期四
angularjs date
https://docs.angularjs.org/api/ng/filter/date
<span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:
<span>{{1288323623006 | date:'medium'}}</span><br>
<span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:
<span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>
<span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:
<span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>
<span ng-non-bindable>{{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}</span>:
<span>{{'1288323623006' | date:"MM/dd/yyyy 'at' h:mma"}}</span><br>
{{1288323623006 | date:'medium'}}: Oct 29, 2010 11:40:23 AM
{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}: 2010-10-29 11:40:23 +0800
{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}: 10/29/2010 @ 11:40AM
{{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}: 10/29/2010 at 11:40AM
2015年11月18日 星期三
angularjs , log in redirect ng-router
http://stackoverflow.com/questions/11541695/redirecting-to-a-certain-route-based-on-condition
'use strict';
var app = angular.module('app', [])
.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: "login.html",
controller: LoginController
})
.when('/private', {
templateUrl: "private.html",
controller: PrivateController,
resolve: {
factory: checkRouting
}
})
.when('/private/anotherpage', {
templateUrl:"another-private.html",
controller: AnotherPriveController,
resolve: {
factory: checkRouting
}
})
.otherwise({ redirectTo: '/' });
}]);
var checkRouting= function ($q, $rootScope, $location) {
if ($rootScope.userProfile) {
return true;
} else {
var deferred = $q.defer();
$http.post("/loadUserProfile", { userToken: "blah" })
.success(function (response) {
$rootScope.userProfile = response.userProfile;
deferred.resolve(true);
})
.error(function () {
deferred.reject();
$location.path("/");
});
return deferred.promise;
}
};
=========================angular.module('yoApp')
.service('appService', function ($q, $timeout, $rootScope, $location) {
this.isAdmin=function(){
console.log("isAdmin");
var deferred = $q.defer();
deferred.resolve(true);
// deferred.reject();
// $location.path("/about");
return deferred.promise;
}
});
.config(function ($routeProvider) {
$routeProvider
.when('/me', {
template: '<h1> me </h1>',
resolve: {
factory: function(appService) {
return appService.isAdmin();
}
}
})
});
2015年11月11日 星期三
angular js Dependency injection
https://www.airpair.com/angularjs/posts/top-10-mistakes-angularjs-developers-make
Dependency injection is one of AngularJS's best patterns. It makes testing much simpler
var app = angular.module('app',[]); app.controller('MainCtrl', function($scope, $timeout){ $timeout(function(){ console.log($scope); }, 1000); });
Here, it's very clear that
Dependency injection is one of AngularJS's best patterns. It makes testing much simpler
var app = angular.module('app',[]); app.controller('MainCtrl', function($scope, $timeout){ $timeout(function(){ console.log($scope); }, 1000); });
Here, it's very clear that
MainCtrl depends on $scope and $timeout.
訂閱:
文章 (Atom)