0

Below is the code i am calling on a factory controler but below code is not working, is there any thing wrong with syntax?

<script>
        EposApp.factory('getCustomization', function () {
            return
            {
                customization: @Html.Raw(Json.Encode(@Model))
            }
        });
    </script>
NoviceToDotNet
  • 10,387
  • 36
  • 112
  • 166

1 Answers1

0

You need to do it like this (remove new line after return),

  EposApp.factory('getCustomization', function () {
                return {
                    customization: @Html.Raw(Json.Encode(Model))
                }
            });

In javascript it does the semicolon insertion , therefore it will take return as a valied statement and your function will return undefined

Community
  • 1
  • 1
Jayantha Lal Sirisena
  • 21,216
  • 11
  • 71
  • 92