naturalprogrammer / lemon-demo-angular1 Goto Github PK
View Code? Open in Web Editor NEWAngular 1.x front end demo project for the Lemon Demo Application
License: Other
Angular 1.x front end demo project for the Lemon Demo Application
License: Other
Hi, I was trying to run the project, but I got the following problem:
the function "http.get().success" came out to be deprecated and it was supposed to get replaced with the function ".then()". The following diff fixed the problem:
git diff
diff --git a/app/scripts/app.js b/app/scripts/app.js
index 91ed384..653aaf7 100644
--- a/app/scripts/app.js
+++ b/app/scripts/app.js
@@ -42,7 +42,7 @@ var serverUrl;
var $http = initInjector.get("$http");
$http.defaults.withCredentials = true;
- $http.get(serverUrl + '/api/core/context').
+ /*$http.get(serverUrl + '/api/core/context').
success(function (data, status, headers, config) {
data.context.user = data.user;
@@ -58,7 +58,25 @@ var serverUrl;
alert("Could not connect to server. Please try refreshing after sometime");
+ });*/
+
+ $http.get(serverUrl + '/api/core/context').
+ then(function (response) {
+
+ response.data.context.user = response.data.user;
+ angular.module('appBoot').constant("context", response.data.context);
+ $http.get(serverUrl + '/api/core/ping'); // otherwise gives CSRF exception if remember-me is activated
+
+ angular.element(document).ready(function() {
+ angular.bootstrap(document, [appName]);
+ });
+
+ }, function (response) {
+
+ alert("Could not connect to server. Please try refreshing after sometime");
+
});
+
};
angular.module('appBoot', ['ngMessages', 'ui.bootstrap', 'vcRecaptcha'])
diff --git a/app/scripts/services/ping.js b/app/scripts/services/ping.js
index c570f09..325e68b 100644
--- a/app/scripts/services/ping.js
+++ b/app/scripts/services/ping.js
@@ -13,10 +13,9 @@ angular.module('appBoot')
return function() {
$http.get(serverUrl + '/api/core/ping')
- .success(function(){
+ .then(function(response){
$log.info("Ping completed");
- })
- .error(function (data, status, headers, config) {
+ }, function (response) {
alerts.addAlert("Could not ping server. Please try refreshing after sometime");
});
};
Loading "grunt-karma.js" tasks...ERROR
TypeError: Cannot read property 'prototype' of undefined
Running "serve" task
Loading "grunt-karma.js" tasks...ERROR
TypeError: Cannot read property 'prototype' of undefined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.