1

I am developing a website using angularjs and am using npm to host a local development server.

I copied my project directory into a public AFS directory and can access the index.html page fine but the npm dependencies arent working. (I am getting the same errors as if I would open my index.html file locally without running "npm start") Specifically, the error happens in a custom validation I created.

angular.module('myApp').directive('customValidator', function() {
  return {
    require: 'ngModel',
    link: function($scope, element, attrs, ngModel) {
      ngModel.$validators.validInput = function(value) {
        -------custom validation-----------
        return isValid;
      };
    }
  }
});

Here it says ngModel does not have a $validators property and therefore I am assigning a value of 'validInput' to undefined, which results in the error.

How can I run my project in this new distributed file system if I can't call npm start on the production directory??

Do I have to create different environments in my app.js? Not really sure what that even means...

Santiago
  • 1,984
  • 4
  • 19
  • 24
  • Does your AFS directory offers you a webserver ? It seems that you're calling some script needing a webserver to be interpreted – mfrachet May 27 '15 at 06:16
  • Hi @Skahrz, I believe it does since it is made for hosting websites. Here is the link to the specifc AFS server I am using https://itservices.stanford.edu/service/web/centralhosting/howto_group – Santiago May 27 '15 at 16:46

1 Answers1

0

Its late though , You can use ngc , see example here https://medium.com/@feloy/building-a-static-website-with-angular-universal-a1acc49e26e5

BTW angular generally are ment to be single page responsive webpages.

rajesk
  • 1,407
  • 1
  • 9
  • 8