简体   繁体   中英

update data with ng-include and ng-click

is it possible To update information using ng-click with ng-include ?

i have those following code index.html:

<div layout-padding="" ng-include src="'form.html'"></div>
<div ng-controller="formCtrl" flex="" ng-click="changInfo()" md-ink-ripple>

form.html:

<md-input-container flex="" class="md-block">
    <label>Description</label>
    <textarea ng-disabled="role || !user.isFlight" ng-model="form.descIsFlight" columns="1" md-maxlength="150"></textarea>
  </md-input-container>

formCtrl.coffee:

$scope.form =
      descIsFlight: "Boeing 747"
$scope.changeInfo = () ->
    $scope.form =
        descIsFlight: "Aibrus A320"

My goal are to remplace the content of the form with the new description Airbus A320 (exmaple reloading the page).

is it possible ?

Thank you

您需要在具有ng-include和ng-click dom元素父范围的控制器中定义$ scope.form

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM