oop classes in an Angular service

Anyway I think these are oop classes, I’m new to this. I’m trying to move some complex stuff written by someone else into an Angular service and I can’t seem to get the syntax right. I have something like this:

angular.module('myApp')
    .service('myService', function () {

    var service = this;

    this.Util = {

     extend: function (blah) {
       //blah blahh
       return blah

    },

     create: Object.create || (function (blah) {

       //blah blah
        return blah

    })(),

     //more blah blah

   };


    var something = this.Util.create(blah);

});

I hope that’s enough detail to tell what I’m doing wrong. It’s telling me it ‘Cannot read property ‘create’ of undefined’.


Source: oop

Leave a Reply