Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing Angular library into Lotus Domino db

I'm experimenting with using Angular and so am looking to import the standard library angular.min.js into a Domino database with Domino designer.

However when I do this, I get zillions of javascript errors in the imported file. I have tried:

  • Pasting in as a javascript script library
  • Importing directly as a Resource file
  • Importing as WebContent via Package Explorer.

The version of angular.min.js I am using is straight from the Angular website, and works just fine if included in a locally run html file.

The symptoms are that firstly including the file doesn't work (generates script errors in browser) and if I look at the resource / script lib etc I see loads of red markers for syntax errors.

The odd part is that the same method(s) to include jquery seem to work fine.

Has anyone else managed this? Surely they must have.. I bet I'm doing something impressivley stupid

In case it's relevant, this is eventually for use in an xpage.

like image 651
user2808054 Avatar asked Dec 08 '22 01:12

user2808054


2 Answers

First: forget about opening the Angular JS file in Designer. It will throw errors because it uses JavaScript syntax that isn't supported by the built-in editor. The file is (probably) just fine.

Next, I'm not sure where you're loading the file exactly, but if you want to do it in an XPage: here's a simple example I just created and that works:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view
    xmlns:xp="http://www.ibm.com/xsp/core">
    <xp:this.attrs>
      <xp:attr
        name="ng-app"
        value="myApp">
     </xp:attr>
    </xp:this.attrs>

<xp:this.resources>
    <xp:script
        src="angular/angular.min.js"
        clientSide="true">
    </xp:script>
</xp:this.resources>

<div ng-controller="MyController">
    {{hello}} this
</div>

<xp:scriptBlock
    id="scriptBlock1">
    <xp:this.value><![CDATA[var app = angular.module('myApp', []);

app.controller('MyController', function($scope) {

  $scope.hello = 'world';

});
]]></xp:this.value>
</xp:scriptBlock>

</xp:view>
like image 173
Mark Leusink Avatar answered Dec 11 '22 09:12

Mark Leusink


Here are some interesting links for starting with angular and domino:

http://hasselba.ch/blog/?p=1458

http://hasselba.ch/blog/?p=1485

http://hasselba.ch/blog/?p=1525

http://hasselba.ch/blog/?cat=50

http://xomino.com/2014/06/01/angular-js-in-xpages-6-a-people-manager-crud-application/

I hope this helps...

like image 45
Georg Kastenhofer Avatar answered Dec 11 '22 10:12

Georg Kastenhofer