DOM manipulation in an AngularJS directive

I serve my AngularJS files from my NodeJS web server. So the external template in this directive is also served from there.

If we need to serve simple content from another web server and manipulate the DOM in a directive to render it appropriately, we can use a directive like this. I am able to manipulate the DOM and also change the innerText of td tags.


directive("testdirective", function(){
 return {
   restrict: "E",
   transclude: true,
   scope: {
     title: "@"
   },
   templateUrl: "/test.html",
   
   link: function(scope, element, attrs){
        
        console.log( document.querySelector('#documents_forms')) ;
        
        var table = angular.element( document.querySelector( '#documents_forms' ) );
        
        var tbodies = element.find('tbody');
        
        var columntext = [];
        
        for( var i = 0; i < tbodies.length; i ++ ){

          var tr = tbodies[i];

          var tds = $(tr).find('td');

          var text = [];

          var documentname;

          for( var y = 0; y &amp;amp;amp;lt; tds.length; y ++ ){

            tds[y].innerText = 'Test';

            documentname = tds[y].innerText;

            text.push( documentname );
          }
          columntext.push( text )
        }
        console.log( columntext );
   }
 };
})

node-gyp rebuild

This does not stop karma from working on my Win 7 32-bit machine. So I was wondering what it means here because on my Mac ‘node-gyp’ actually built after I updated my XCode for Mavericks. I mean that on the Mac I saw the same error initially but after my XCode update ‘node-gyp’ was built and this error vanished.

FSEvents is an API only available on OS X:

http://en.wikipedia.org/wiki/FSEvents

Therefore it is understandable that the fsevents npm module which provides a node interface to that OS API cannot be built on systems other than OS X.In the case of karma it appears to have been handled by making fsevents an optional dependency.

Mac OSX Mavericks

> fsevents@0.3.5 install /usr/local/lib/node_modules/karma/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild

SOLINK_MODULE(target) Release/.node
SOLINK_MODULE(target) Release/.node: Finished
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
SOLINK_MODULE(target) Release/fse.node: Finished

> ws@0.4.32 install /usr/local/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/bufferutil.node
SOLINK_MODULE(target) Release/bufferutil.node: Finished
CXX(target) Release/obj.target/validation/src/validation.o
SOLINK_MODULE(target) Release/validation.node
SOLINK_MODULE(target) Release/validation.node: Finished

Windows 7 32-bit

This seemed to be a problem until I installed Visual Studio Express 2005.

d:\jwt\sails-angular-jwt-example-master\sails-angular-jwt-example-master\node_mo
dules\bcrypt>node “d:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modul
es\node-gyp\bin\node-gyp.js” rebuild
blowfish.cc
bcrypt.cc
bcrypt_node.cc
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning
C4530: C++ exception handler used, but unwind semantics are not enabled. Specif
y /EHsc [d:\jwt\sails-angular-jwt-example-master\sails-angular-jwt-example-mast
er\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
C:\Users\476458\.node-gyp.10.35\deps\v8\include\v8.h(184): warning C4506: no
definition for inline function ‘v8::Persistent v8::Persistent::New(v8::Ha
ndle)’ [d:\jwt\sails-angular-jwt-example-master\sails-angular-jwt-example-ma
ster\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
with
[
T=v8::Object
]
Creating library d:\jwt\sails-angular-jwt-example-master\sails-angular-jwt
-example-master\node_modules\bcrypt\build\Release\bcrypt_lib.lib and object d
:\jwt\sails-angular-jwt-example-master\sails-angular-jwt-example-master\node_
modules\bcrypt\build\Release\bcrypt_lib.exp
Generating code
Finished generating code
bcrypt_lib.vcxproj -> d:\jwt\sails-angular-jwt-example-master\sails-angular-j
wt-example-master\node_modules\bcrypt\build\Release\\bcrypt_lib.node
bcrypt@0.7.8 node_modules\bcrypt
└── bindings@1.0.0