Hello Martin,

I do make it work well in a large app which uses angular+requireJS.

the "invalid require call" occurs when there is a call like,

require('dependency', function (dependency) {});

so you need to change it 

require(['dependency'], function (dependency) {});

Could you pls check if there is such error in your other modules?

BTW, do you know this
https://github.com/tastejs/todomvc/tree/gh-pages/labs/dependency-examples/angularjs_require

On Saturday, December 28, 2013 2:11:00 AM UTC+8, [email protected] wrote:
>
> Hello Edward,
>
> thanks for your reply - unfortunately, this doesn't work either. I always 
> get an "invalid require call" error?!
> The main module logic is from the seed-code. It's neccessary to do a 
> deferred bootstrap but it doesnt seem to have any impact on the 
> module-loading.
> Do you have any other suggestions? Did you already make it work? I cant 
> find any documentation on how to achieve this via requirejs - it seems to 
> be only possible by inserting the sanitize-script manually in the page 
> header.
>
>
>
>
> Am Donnerstag, 26. Dezember 2013 07:49:39 UTC+1 schrieb Edward:
>>
>> RequireJS takes charge of loading js files into browser, while Angular 
>> injects correct
>> objects when creating modules.
>> That is to say, your js files should be loaded into the browser before 
>> Angular injection.
>>
>> so you need to
>>
>>     require([
>>         'angular',
>>         'app',
>>         'angularSanitize'
>>     ......
>>
>> BTW, your requireJS main module seems a little strange, I just used the 
>> following logic,
>>
>>     angular.bootstrap(document, [ "name" ]);
>>
>> Hope this helps.
>>
>> On Wednesday, December 25, 2013 9:26:53 PM UTC+8, [email protected] wrote:
>>>
>>> Hi there,
>>>
>>> I'm currently in need of ngSanitize for an Angular project. But I dont 
>>> get it to work.
>>> I'm using the requirejs-angular-seed from 
>>> https://github.com/angular/angular-seed
>>>
>>> The thing is, I have to use 'ng-bind-html' and therefore I need to 
>>> import the angular-sanitize module. 
>>> But with requireJS it never seems to get loaded.... this is my 
>>> require-configuration-file:
>>>
>>> require.config({
>>>     paths: {
>>>         angular: '../bower_components/angular/angular',
>>>         angularSanitize: 
>>> '../bower_components/angular-sanitize/angular-sanitize'
>>>     },
>>>     shim: {
>>>         'angular' : {'exports' : 'angular'},
>>>         'angularSanitize' : {'deps' : 'angular'}
>>>     },
>>>     priority: [
>>>         "angular"
>>>     ]
>>> });
>>>
>>> //
>>> http://code.angularjs.org/1.2.1/docs/guide/bootstrap#overview_deferred-bootstrap
>>> window.name = "NG_DEFER_BOOTSTRAP!";
>>>
>>> require( [
>>>     'angular',
>>>     'app'
>>> ], function(angular, app) {
>>>     'use strict';
>>>
>>>     var $html = 
>>> angular.element(document.getElementsByTagName('html')[0]);
>>>
>>>     angular.element().ready(function() {
>>>         angular.resumeBootstrap([app['name']]);
>>>     });
>>> });
>>>
>>>
>>>
>>> I dont know how to make angular-sanitize work with requireJS? Any 
>>> recommendations or best practices?
>>>
>>>
>>> Thanks in advance and cheers,
>>> Martin
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to