Skip to content

use hook

MaelVB edited this page Jul 30, 2021 · 2 revisions

Hook Creation

I. Use a Hook

If you have created your hook and you want to use it, or you just want to reuse a hook, please follow this tutorial.

I.1 Use the hook for mutiple value

The ng-repeat directive is used in the HTML, so you just need to add a value to the variable which is used in the loop.

ProductControllers.controller("nsProductGeneral", [
    "$scope", "$filter", "ClientFields", "TheSecondInjection", "SetAttributesV2", "AttributesV2", "$modal", "ProductsV2",
    function ($scope, $filter, ClientFields, TheSecondInjection, SetAttributesV2, AttributesV2, $modal, ProductsV2) {
        //maybe some code of the controller here
        $scope.test = [ ClientFields, TheSecondInjection]; //we add a value to the scope
        //maybe other some code of the controller here
    }]);

Legend :

  • You just made a array with two values : the old ClientsFields and the new TheSecondInjection
  • Note two injections : ClientsFields and TheSecondInjection, the injection is done twice
  • Note that you need to confirm the edit of service of the page just like above
Clone this wiki locally