1

Im trying to include a file with ng-include, but it don't work. The file should be included when you press on a button:

<button type="submit" class="btn btn-primary" ng-click="getPartial()">Jämför</button>

Here is my function in the controller:

$scope.getPartial = function() {
            $scope.showCompare = '../partials/compare.html';
            console.log($scope.showCompare);
        };

And here is my div:

<div data-ng-include data-ng-src="showCompare"></div>

Nothing is included. Have I done something wrong?

user500468
  • 1,183
  • 6
  • 21
  • 36

1 Answers1

0

change this:

<div data-ng-include data-ng-src="showCompare"></div>

to either this:

<div data-ng-include src="showCompare"></div>

or this:

<div data-ng-include="showCompare"></div>
Raghavendra
  • 5,281
  • 4
  • 36
  • 51