Neha Mangla
Neha Mangla

Reputation: 1054

Codeigniter and angular js integration

I am new into both and unable to access angular in my codeigniter code. I have created simple code in angular which is :

<body ng-app="">
  <p>Name : <input type="text" ng-model="name"></p>
  <h1>Hello {{name}}</h1>
</body>

I have also inserted both angular.min.js and angular-route.min.js inside tag but when I run this application, it displays following error in console :

Uncaught Error: [$injector:modulerr]

While if I execute this code seperately, it works perfect. Can anyone please help me out in resolving this issue. PS : I know many have asked this question earlier. I tried given solution but nothing worked out in my case. May be I am unable to understand the solution they have provided. It will be a great help if someone provides a simple solution of given problem.

Thanks in advance.

Upvotes: 1

Views: 302

Answers (1)

Akshay Singhai
Akshay Singhai

Reputation: 189

Try this, Will help you

<?php
defined('BASEPATH') OR exit('No direct script access allowed');?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
</head>
<body ng-app="">
  <p>Name : <input type="text" ng-model="name"></p>
  <h1>Hello {{name}}</h1>
</body>
</html>

Upvotes: 1

Related Questions