Monthly Archives: June 2016

notify another controller

http://stackoverflow.com/questions/19515017/notify-of-changes-between-controllers-that-may-or-may-not-exist Using events (emit or broadcast in the scope) in 1 controller $rootScope.$broadcast(‘logged in’, {‘username’ : response.data.username}); in another controller $scope.$on(‘logged in’, function (event, data) { $scope.username = data.username}); Using a Service / Factory  

Posted in Angularjs | Leave a comment

403 when access rest api

1 reason is that the domain class doesn’t have @Secured() defined, ie., grails doesn’t have idea on which kinds of user can get the data

Posted in Grails | Leave a comment

400 bad request for grails rest api

make sure the post body use ” instead of ‘ {“username”:”sp@ss.com”,”password”:”ss123″}   http://localhost:8080/api/login the response { “username”: “sp@ss.com”, “roles”: [ “admin” ], “token_type”: “Bearer”, “access_token”: “eyJhbGciOiJIUzI1NiJ9.eyJwcmluY2lwYWwiOiJINHNJQUFBQUFBQUFBSlZTUDBzY1FSUlwvdTdsRGc1Qm9JSUxGMmNSMFlROWllWTFSTkJBV0k1elhHQkRtZHArYjBkbVp5Y3lzM2pYaHFsaFluR2dFd2FcL2dOekZOUGtCSWlyVFd0bm16bnU0bGpXU3I0YzF2ZlwvXC9lWEY1RDNScFl6QXpqd2taYUZCbVhrZFdHeTh4aVVoanUrbEZoMGFUb1NzVGJFdGloQ2R4K1FRaEJEQ0ZQSFR5TGQ5aythd29tcytiNzdpNG1ydFV6OEZxWmJNUzRZMWlPQjhyc1JmZmNpVEw0bDBCRkhSeUhNTEVGTXl4SlZDSGR1cEtyUGMwTnBsc3dYYzFpbGV6NTBmT0VibEE2em9RZGgwNmdaRjJCYVF4VHJIQWZGYWx5dEE2ZTNwb3RIQmZOTnJwV0RKT2FXVXZ1XC9rblNkdDY2dlwvYzJKU1g0QkoraDF0TUJmZFRkU3crTlBFKzBvb1NnMUZ4SnU5Q1J1VXI1RHZmaXhEOW9uSHdmWGd3NklRQjE4dXJoZjZyNTNESU1yclp2NXN1aWc4VEI3SmoxQ3RicWFYSXpVekZ2R3ZUS1A4NDNUcyt1RHo4OEltV1BXUHZcL2ZTeTh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OYllqb2oybytUT1JMejlNZnJlRmZ0VG11UlpJTDBvNlRPOGxLbUtLV3pOSzNQWHRvTTdTbkV0XC9lbXoxa3JWRW1KUG9rekt6WDFZVUsxclYwZVwvamI4TVhQNG5nSGRUM21TaVFLcCt1UU90RjNrWHo1ZktzTWZYMTExRVpZUFNZd3o5Ylp0cWFFQU1BQUE9PSIsInN1YiI6InNwQHNzLmNvbSIsInJvbGVzIjpbImFkbWluIl0sImlhdCI6MTQ2NTk3MTE5Mn0.9BQ9VY3SpZLLTbcDc8KiSNmwsBb9nc1wFtqfi019xno” }

Posted in Grails | Leave a comment

glyphicon not shown

need to have /fonts folder with glyphicons-halflings-regular.* file in the same folder as /css client can have access to the /fonts url, in my case, it’s restricted by the authentication

Posted in Bootstrap | Leave a comment

use function for template url

.state(‘shoppingCart’, { url : “/shoppingCart”, templateUrl : function($routeParams){ return ‘template/deliveryStatus.html’ }, controller : ‘shoppingCart’, controllerAs : ‘shoppingCart’ })

Posted in Angularjs | Leave a comment