0

I'm trying to implement a text editor with textAngular in a CodeIgniter view, but it keep returning this error:

angular.js:13424 Error: [ng:areq] Argument 'wysiwygeditor' is not a function, got undefined
http://errors.angularjs.org/1.5.3/ng/areq?p0=wysiwygeditor&p1=not%20a%20function%2C%20got%20undefined

Where 'wysiwygeditor' is the name on ng-controller.

I've found tens of questions about that, and all seems to be caused by the same mistakes:

  • Unnamed ng-app directive
  • Omitted second argument on module definition angular.module('myApp', [])
  • Version incompatibilities on controller declaration

None of those happens to be the problem, and I'm simply copying a code that already works. It's the demo.html from textAngular-1.5.0. I copy the code to a CodeIgniter view, include all the required libraries, but still get the error. Then I noticed it's happening whenever I declare a controller with Angular JS.

To make a better example:

<script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.3.11/angular.min.js'></script>
<div ng-app="myApp">
    <div ng-controller="GreetingController">
        {{greeting}}
    </div>
</div>
<script>
    var myApp = angular.module('myApp',[]);

    myApp.controller('GreetingController', ['$scope', function($scope) {
      $scope.greeting = 'Bom dia!';
    }]);
</script>

This code gives that error on CodeIgniter, but if I put it in a simple html file, works normally.

2 Answers2

0

Here is your edited working code... Dont use editor, Its waste of your time, They are mostly not working , some time its working...

<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.11/angular.min.js"></script>
<body>

<div ng-app="myApp" >
<div ng-controller="GreetingController">
{{greeting}}
</div>
</div>

<script>
var app = angular.module('myApp', []);
app.controller('GreetingController', function($scope) {
    $scope.greeting= "John";

});
</script>

</body>
</html>
nisar
  • 1,055
  • 2
  • 11
  • 26
  • Thanks, but I'm not using an editor, I'm trying to implement an text editor to my client. My problem is that I can't manage to declare an Angular JS controller in a CodeIgniter View, and make it work. – Albert Uler Silva Melo Apr 06 '16 at 14:04
0

My fault, my project was declaring an ng-app on a parent element, in a template file that I've forgot that existed. Removed this tag, and AngularJS stop returning that error.