2

I read several tutorials about it, but I can't figure out what is wrong:

HTML

<!DOCTYPE html>
<html ng-app="dfuApp" ng-controller="dfuController">
    <head>
        <title>Angular JS Test</title>
    </head>
    <body>
        <div>
            current status: {{status}}
        </div>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
        <script type=”text/javascript” src="js/app.js"></script>
    </body>
</html>

aps.js

//Define an angular module for our app 
console.log('here');
var app = angular.module('dfuApp', [])

app.controller('dfuController', function ($scope, $http) {
    getStatus();
    function getStatus() {
    $http.get("../getStatus.php").success(function (data) {
        $scope.status = data; //the data are stored in projects
        });
    };
});

getStatus.php

<?php

$mysqli = new mysqli(credentials);

// The mysql database connection script

$query = "select statusid from metadata";
$result = $mysqli->query($query) or die($mysqli->error . __LINE__);

$arr = array();
if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        $arr[] = $row;
    }
}

//JSON-encode the response
echo $json_response = json_encode($arr);

This example was taken from several example-Sites like this, that and finally this here.

I double-checked it and I can't find any errors. In my console, it says:

[$injector:modulerr] http://errors.angularjs.org/1.3.15/$injector/modulerr?p0=dfuApp&p1=Error%3A…gleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.15%2Fangular.min.js%3A17%3A381)

which finally leads to the following:

This error occurs when a module fails to load due to some exception. The error message above should provide additional context.

Any Idea why this isn't working? What am I missing?

1
  • Could you follow the link in the [$injector:modulerr] error, it should provide more info what goes wrong Commented Jan 15, 2016 at 9:38

1 Answer 1

3

It should be " instead of

Convert this

<script type=”text/javascript” src="js/app.js">

to this

<script type="text/javascript" src="js/app.js">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.