Coder Social home page Coder Social logo

lemon-demo-angular1's People

Contributors

naturalprogrammer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lemon-demo-angular1's Issues

Unable to run project

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

Unable to start the demo project

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");
         });
     };


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.