JavaScript Using angular directives with prototype or object initializar approach using angular directives,@ in angular directive,u003d in angular directive

i'm trying to use angular directives with prototype or object initializer. Examples:

Prototype:

'use strict';
var Example = function Example($scope, $elem) {
  this.$scope = $scope;
  this.$elem  = $elem;

  this.init();
};

Example.prototype.init = function() {
  /// rest
};

var exampleDirective = function() {
    return {
        restrict: 'M',
        link: function($scope, $elem) {
            return new Example($scope, $elem);
        }
    };
};

angular
    .module('adminApp')
    .directive('exampleDirective', exampleDirective);

Object initializer:

'use strict';
var Example = {
  init: function($scope, $elem) {
    this.$scope = $scope;
    this.$elem  = $elem;


    // rest
  }
};

var exampleDirective = function() {
    return {
        restrict: 'M',
        link: function($scope, $elem) {
            return Example.init($scope, $elem);
        }
    };
};

angular
    .module('adminApp')
    .directive('exampleDirective', exampleDirective);

Both work, but i'm trying to figure out how should i use, if there is a convention for that.

I already search a lot about using angular directives like this and the most closer answer that i found is this: Let's Make Full-Ass Angular Directives

I'm searching for a difference approach.

Thanks.

Answer:1

i'm trying to fetch data from oracle database and store it into an array using JavaScript . but the output I'm getting "undefined". how can i fix it?Can anyone help me. <!DOCTYPE HTML PUBLIC "-//...

i'm trying to fetch data from oracle database and store it into an array using JavaScript . but the output I'm getting "undefined". how can i fix it?Can anyone help me. <!DOCTYPE HTML PUBLIC "-//...

  1. fetching data from api
  2. fetching data from api react
  3. fetching data from an api using react/redux
  4. fetching data from firebase
  5. fetching data from database in java
  6. fetching data from multiple tables in jpa
  7. fetching data from nested table in oracle
  8. fetching data from cdhdr and cdpos table
  9. fetching data from database
  10. fetching data from database in php
  11. fetching data from database in django
  12. fetching data from firebase android
  13. fetching data from api in angular
  14. fetching data from json file
  15. fetching data from two tables in sql
  16. fetching data from api in react native
  17. fetching data from api in flutter
  18. fetching data from database in laravel
  19. fetching data from multiple tables in sql
  20. fetching data from mongodb

I have an SVG path which is just like an outline of a cup, and I was wondering how I can animate a fill to fill it up with water like blue liquid that slowly rises up in the cup? All the tutorials ...

I have an SVG path which is just like an outline of a cup, and I was wondering how I can animate a fill to fill it up with water like blue liquid that slowly rises up in the cup? All the tutorials ...

  1. animate weapon
  2. animate dead 5e
  3. animate guardian
  4. animate object 5e
  5. animate definition
  6. animate css
  7. animate weapon 3.10
  8. animate guardian poe
  9. animate cc
  10. animate a name
  11. animate objects
  12. animate online
  13. animate weapon build
  14. animate dead mtg
  15. animate me
  16. animate yourself
  17. animate dead pathfinder
  18. animate online shop
  19. animate synonym
  20. animate a picture

In my case, I have a Java Web based in Gradle. In my web project I have files .js which I want to make unit testing using JASMINE. I need execute this test when the command "gradle build" is called. ...

In my case, I have a Java Web based in Gradle. In my web project I have files .js which I want to make unit testing using JASMINE. I need execute this test when the command "gradle build" is called. ...

  1. jasmine automation test

I'm trying to make a grade distributions website, and I'm creating 4 dropdowns correlating subject (cs, math, etc.), class (data structures, AI, etc.), professor, and quarter the class was taken. ...

I'm trying to make a grade distributions website, and I'm creating 4 dropdowns correlating subject (cs, math, etc.), class (data structures, AI, etc.), professor, and quarter the class was taken. ...