How to use Textangular with Jhipster

380 views Asked by At

I´m doing the jhipster example (book and author) and I want to use textangular for description fields. I used this guideline (https://github.com/fraywing/textAngular) to do the changes but it does not work.

The question is, if anyone knows a guide to using textangular with jhipster as an example: What files I should modify, how, etc.

I am new at this tried to follow the guide but something is not working.

  1. I am doing the JHipster example :http://jhipster.github.io/creating_an_entity.html
  2. I executed Via Bower: bower install textAngular
  3. I modified test\src\main\webapp\scripts\app\entities\book\book-detail.html

adding <div text-angular ng-model="htmlVariable"></div>

  1. I added the script src='/bower_components/textAngular/dist/ explained in the guideline.

  2. Currently I tried to do the step 4 explained in the textangular guideline

    a. Add a dependency to textAngular in your app module, for example: angular.module('myModule', ['textAngular']).

    b. I tried some option but it does not work.

c. The current controller file is the following:

'use strict';

angular.module('testApp')
    .controller('BookDetailController', function ($scope, $stateParams, Book, Author) {
        $scope.book = {};
        $scope.load = function (id) {
            Book.get({id: id}, function(result) {
              $scope.book = result;
            });
        };
        $scope.load($stateParams.id);
    });

Could you help me to understand how can I add this line angular.module('myModule', ['textAngular']) without breaking the page, please.

1

There are 1 answers

0
atomfrede On

At least you should add to your bower.json and run bower update afterwards (this should download all required files into your bower_components directory).

Now you add all required files (js, css) to your index.html as described in textangular howto. Or do you have a more specific problem?

EDIT:

Go to your app.js file (src/main/webapp/app.js). There you find the module defintion: angular.module('jhipster', ['LocalStorageModule'...]. If you named your application different 'jhipster' will be your application name. Just add 'textangular' at the end of the list of injected modules: e.g:

angular.module('jhipster', ['LocalStorageModule','tmh.dynamicLocale','pascalprecht.translate',
'ngResource', 'ui.router', 'ngCookies', 'ngCacheBuster', 'infinite-scroll', 'textTangular'])