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
  • 9,889
  • 32
  • 106
  • 163

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
  • 20,846
  • 10
  • 70
  • 92