Skip to main content
Hey there,

i'm working on a lightning component that uses angularJS 1.6;

Has anyone experienced data binding issues between controllers and views?

I've got a list of things that are currently not working well:

Automatically bootstrapping

Having a angular-app like

angular.module('app', []);

and trying to instanciate angular through:

<div id="app-container" data-ng-app="app">

<div data-ng-controller="appController">

<div id="calendar"></div>

</div>

</div>

results in:

Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:

Error: [$injector:nomod] Module 'app' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

To fix it, I need to bootstrap angular manually. Seems to be an issue with loading the angular scripts. I have vendors.js and app.js being loaded this way:

 

<ltng:require scripts="{!join(',', $Resource.MyResource+ '/scripts/vendor.js', $Resource.MyResource+ '/scripts/app.js')}"/>

Angular databinding not working:

For example I have this controller:

angular

.module('app')

.controller('appController', function($scope, $log){

$scope.hello = 'Hallo';

})

And my view looks like:

 

<div data-ng-controller="appController">

{{hello}}

</div>

The view should render the word 'Hallo'.

But it still remains in {{hello}}.

Another thing is, that the way angular provides including templates with data-ng-include and paths doesn't also work:

 

<div data-ng-include="'app/hello.html'"></div>

app/hello.html is stored in the angular template provider.

This results in following:

<!-- ngInclude: 'app/hello.html' -->

But the content of hello.html is never rendered in the DOM.

Does anyone has experienced similar behaviour or has some ides how to fix them?

Thanks in advance!

Regards

Flo

 
1 answer
0/9000