I've see a lot posts about codeigniter and angularjs work together,but most of them are about retriving data and pass data .My question is more basic.
I run the site through php,then every thing is ok,means that angularjs work properly.But when I run it through controller,it didn't work.what's wrong?Here are parts of my codes:
<body ng-app="myApp" ng-controller="myCtrl">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
<br>
Full Name: {{firstName + " " + lastName}}
class First extends CI_Controller{
public function index(){
$this->load->view('first');
}
}
var app = angular.module('myApp', ['ngMaterial']);
app.controller('myCtrl', function($scope) {
$scope.firstName = "John";
$scope.lastName = "Doe";
});
my controller file is first.php,view file is first.php as well.when I browse the site by http://localhost/ci_ngtest/index.php/first, the first and last name input are blank,and the Full name show {{firstName + " " + lastName}} instead of John Doe
here is my project structure:
--application
--node_modules
--angular
--angular.js
--angular-material
--system
--user_guide
--somefiles(somefiles below)
angularjslibrary in your view ...?