Angularjs,如何将工厂返回值分配给多个范围

时间:2016-09-03 10:10:00

标签: angularjs

我在单页面中有两种形式供参考,一种用于实际数据输入。我将工厂返回值分配给两个范围,但是当我更改范围serviceData的值时,serviceDataRef的值也会更改

public class SingleItemView extends ListFragment{
SongAdapter songAdapter;
SongsManager songsManager = new SongsManager();
public ArrayList<SongModel> songsList = new ArrayList<>();
public ArrayList<SongModel> recentSongList = Constant.recentSongList;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View windows = inflater.inflate(R.layout.recent_playlist, container, false);
    Log.i("recent Song List...","..."+recentSongList.size());
    return windows;
}
@Override
public void onViewCreated(View v, Bundle savedInstanceState) {
    super.onViewCreated(v, savedInstanceState);

    final ArrayList<SongModel> songsListData = songsManager.songList;
    Log.i("songsListData...", "" + songsListData.size());
    songAdapter = new SongAdapter(getActivity(),recentSongList);
    setListAdapter(songAdapter);

    final ListView lv = getListView();
    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

        }
    });
}}

但是当我通过调用工厂两次分配范围时它将起作用

wsp.getSearviceAreaData()
 .success(function(data) {
    $scope.serviceData = data;
    $scope.serviceDataRef = data;
})

可能有什么问题请帮忙

0 个答案:

没有答案