Friday, 17 July 2015

angluarjs ng-include and scope

if you use ng-include to include a a page , this main page has nothing but just the ng-clude.

This sub-page has a ng-model a ng-click, and in this ng-click function will use the ng-model.

The problem is when you click, the ng-click's function can get called and the value of model is undefined.

to fix that, we should do:

<form ng-submit="addLine(lineText)">< xxxxxxx ng-model="lineText"

$scope.clickfunction = function(lineText) {
        text: lineText

No comments:

Post a comment