Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

infinite-scroll error #3003


User avatar
0
avanekar02 created

Hello

i get this following error when using infinite scroll, i have defined in app.js as

var appModule = angular.module("app", [ "ui.router", "ui.bootstrap", 'ui.utils', "ui.jq", 'ui.grid', 'ui.grid.pagination', "oc.lazyLoad", "ngSanitize", 'angularFileUpload', 'daterangepicker', 'angularMoment', 'frapontillo.bootstrap-switch', 'abp', 'infinite-scroll', 'ngFileUpload' ]);

in AppBundleConfig.cs i have added

ScriptPaths.infinite_scroll,

in Scriptpaths i have added public const string infinite_scroll = "~/libs/temp/infinite-scroll.js";

and have stored the js file under libs/temp/infinite-scroll.js

when i run the app i get the error

Uncaught ReferenceError: angular is not defined at ng-infinite-scroll.min.js:2


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Did you added

    ScriptPaths.infinite_scroll,
    

    after angularjs in your AppBundleConfig.cs ?

    Thanks.

  • User Avatar
    0
    avanekar02 created

    yes i did add the above line.

    in the sample application they have shown

    <div ng-app='myApp' ng-controller='DemoController'> <div infinite-scroll='loadMore()' infinite-scroll-distance='2'> <img ng-repeat='image in images' ng-src='http://placehold.it/225x250&text={{image}}'> </div> </div>

    and in the js as

    var myApp = angular.module('myApp', ['infinite-scroll']); myApp.controller('DemoController', function($scope) { $scope.images = [1, 2, 3, 4, 5, 6, 7, 8];

    $scope.loadMore = function() { var last = $scope.images[$scope.images.length - 1]; for(var i = 1; i <= 8; i++) { $scope.images.push(last + i); } }; });


    i want ti use this in the frontend i have a partial page, i have a function in the controller, the partial page. how do i add the above js code to the frontend within script tags. any examples .

    Regards Anwar

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    If you want to use it in the frontend, you can add it to <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/dev/src/MyCompanyName.AbpZeroTemplate.Web/App_Start/Bundling/FrontEndBundleConfig.cs">https://github.com/aspnetzero/aspnet-ze ... eConfig.cs</a>.

    But frondend does not contain angularjs files by default. I suggest you to use a jquery infinite scroll library for the frondend. You can find a good one on the internet.

    Thanks.