1

I followed code at https://phpcmsforce.wordpress.com/ but I cannot seem to make the data display. Please tell me if I am missing something!

index.html:

<!DOCTYPE html>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="app.css" />
<script src="bower_components/angular/angular.js"></script>
<script src="app.js"></script>

<html ng-app=”rjtApp”>

<head>BLAH </head>

<body ng-controller=”projectsController”>
<div ng-include src=”Project.html”></div>

</body> </html>

Project.html:

<!DOCTYPE html>
<html lang="en">
<head></head>
<meta charset="UTF-8">

<body>
<table ng-controller=”projectsController”>

    <thead><tr><th>Title</th><th>App Type</th><th>Code</th><th>Type</th></tr></thead>
    <tbody>

    <tr ng-repeat="project in projects">
        <td>{{project.title}}</td>
        <td>{{project.type}}</td>
        <td>{{project.pcode}}</td>
        <td> <div ng-if="project.proj_type = 'Internal'"> <span class='label label-primary'>{{project.proj_type}}</span> </div> <div ng-if="project.proj_type = 'External'"> <span class='label label-info'>{{project.proj_type}}</span> </div> </td>

    </tr>
    </tbody> </table>

app.js:

'use strict';
var app = angular.module('rjtApp' []);

app.controller('projectsController', function ($scope, $http)
{
 getProject();
 function getProject() {
$http.post("getProject.php").success(function(data)) {
  $scope.projects = data;
  });
 };
}

config.php:

<?php

define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', '127.0.0.1');
define('DB_NAME', 'project');
?>

getProject.php:

<?php
require_once'config.php';

$query="select * from tbl_projects";
$result = $mysqli->query($query) or die($mysqli->error,__LINE__);
$arr=array(); if($result->num_rows>0) {
    while ($row = $result->fetch_assoc()) {
        $arr[] = $row;
    }
}
echo $json_response = json_encode($arr);
?>

It is just displaying {{project.title}}, etc. on the Project.html browser. And when I display index.html, nothing shows up I cannot figure out what I am doing wrong

2
  • 2
    if it shows unrendered angular template tags then try to open the browsers dev tools and se if you get any errors logged to the console.
    – JimL
    Commented Dec 9, 2016 at 20:29
  • why do you have all these things in project.html? <!DOCTYPE html> <html lang="en"> <head></head> <meta charset="UTF-8"> its already there in index.html <body>
    – Nilesh
    Commented Dec 9, 2016 at 21:56

0

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.